Referencing control on one form from another form VB.NET

Posted by Tom on Stack Overflow See other posts from Stack Overflow or by Tom
Published on 2010-12-17T14:40:14Z Indexed on 2010/12/21 6:54 UTC
Read the original article Hit count: 193

Filed under:

My gosh man, why is this so complicated in VB.NET? As you can guess, I'm kind of new to .NET and just want to reference a control on one form from another.

Usually I would just do Form.Control.Property but that doesn't work and every example I've found through Google doesn't work for me.

It just seems overly complicated with public classes, etc.

Is there a more simpler way to do this? I'm ready to throw in the towel and just use a global variable at this point.

I have the form containing the control I want to reference, frmGenerate which has a textbox called txtCustomerNo.

From this form through a button's click event I want to show another form, frmCustomers, and have that form reference the value in txtCustomerNo.

frmCustomers.ShowDialog()

It has to be something simple that I'm just not grasping.

Thanks.

© Stack Overflow or respective owner

Related posts about vb.net