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!!!!!!!
Visual Basic Classic.NET Programming

Avatar of undefined
Last Comment
Pryrates

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Pryrates

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Pryrates

here is a working sample
twoforms.zip
adamchicago

ASKER
Thank you very much!
Pryrates

you are welcome :)
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23