Access a form's control from another class

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to access a control (say a textbox) in a window (a form) from another
class (MyClass). Both my form class and MyClass are in the same project. Now,
since the controls are declared as internal (Friend in VB.NET), I shud be
able to acess them. Even though I'm able to get all the controls in
IntelliSense, I'm not able to set the values into them.

Dim myVBForm As New MyForm()
myVBForm.TextBox1 = "Hello"

Any insight into this is greatly appreciated.

Thanks.
 
I want to access a control (say a textbox) in a window (a form) from another
class (MyClass). Both my form class and MyClass are in the same project. Now,
since the controls are declared as internal (Friend in VB.NET), I shud be
able to acess them. Even though I'm able to get all the controls in
IntelliSense, I'm not able to set the values into them.

Dim myVBForm As New MyForm()
myVBForm.TextBox1 = "Hello"

Any insight into this is greatly appreciated.

Thanks.

Do't know if it's the same in VB, but in C# I would have to use

myVBForm.TextBox1.Text = "Hello"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top