Link to home
Start Free TrialLog in
Avatar of adamchicago
adamchicago

asked on

vb.net: How do you use textbox.text as string variable in another class?

Experts, this should be an easy one...I have a textbox on a form and need help figuring out how to use its  .text value in another form's code page (is that a class?).  For example there's a form with the textbox "NameTB" therefore the user input value would be captured in the Me.NameTB.text for that form.  However I need to use the value from Me.NameTB.text in code associated with another form (a separate class)...how do you do that?  I thought I could just do this: (but I got an error saying textbox cannot be converted to string)

Public NameTBtwo as string
NameTBtwo = Me.NameTB.text

...then use the "NameTBtwo" variable in the code associated with another form, but it doesn't work.

Any help is greatly appreciated...thank you!!!!!!!
ASKER CERTIFIED SOLUTION
Avatar of Pryrates
Pryrates
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
here is a working sample
twoforms.zip
Avatar of adamchicago
adamchicago

ASKER

Thank you very much!
you are welcome :)