Click to See Complete Forum and Search --> : Passing Data


Beth Poka
October 18th, 2001, 09:30 AM
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

robby bassic
October 18th, 2001, 01:40 PM
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.