Ask the Expert

How do you reference a form control from a module?

How do you reference a form control from a module? This is something that should be easy to do but it's nowhere in the documentation. This is what I've tried so far:

Dim objfrmMain as form
objfrmMain = New frmMain
objfrmMain.control ?????????
Since form controls are declared with Friend scope in VB.NET, you are probably running into the issue that those controls can only be accessed from code inside the same assembly. The documentation is quite clear about the Friend levels of recognition.

This was first published in May 2003

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: