CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Passing Data

  1. #1
    Join Date
    Aug 2001
    Posts
    16

    Passing Data

    I've 2 text boxes and 2 command buttons. I want to pass the data gather by the 2 text boxes from one command button to the other. Here is my code.

    Dim Textvalue As String

    Private Sub Command1_Click()
    Call GetTextValue(Passedvalue)
    End Sub

    Private Sub GetTextValue(ByVal Passedvalue As String)
    Passedvalue = (Text1.Text) & (Text2.Text)
    End Sub

    Private Sub Command2_Click()
    Call GetTextValue(Passedvalue)

    End Sub

    What did I do wrong?
    Thanks
    Beth


  2. #2

    Re: Passing Data

    Private strValue As String

    Public Property Let pWhatever(ByVal x As String)
    strValue = x
    End Property

    Public Property Get pWhatever() As String
    pWhatever = strValue
    End Property

    '// Place the above code in your Main mod.

    Private Sub Command1_Click()
    pWhatever = Text1.Text & Text2.Text '// this will assign to the Property
    End Sub


    Private Sub Command2_Click()
    MsgBox pWhatever '// this will allow you to see the value of the Property

    End Sub

    I don't understand why you want to send the data from one button to another.
    If that's all you need to do, you can assign the values to the .TAG property of button1(when clicked)
    then button2 would read the .TAG value of button1.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured