You have to create an instance of the form. In VB6, if you defined a form
in the IDE and called it "frmOne", you could access it from a module using
"frmOne.TextBox 1.Text" etc. In .NET, you should create an instance of the
form - Dim mvForm As New frmOne - then you can use "mvForm.TextBox 1.Text"
Here's a basic outline of a "standard" form and module project - just
remember to set the startup point to Sub Main, and not your form;
Module Blah
Public Sub Main()
Public myForm As New FrmOne
Application.Run (myForm)
End Sub
Public Sub MyCommonModuleS ub()
myForm.Button.T ext = "Code ran"
End Sub
End Module
Class FrmOne
/// Form initialisation, component code, etc ///
Private Sub Button_Click(pS ender As Object, pArgs As EventArgs) Handles
Button.Click()
MyCommonModuleS ub()
' button text on the form will now be changed
End Sub
End Class
_______________ _______________ ______
The Grim Reaper
"Mark D" <an*******@disc ussions.microso ft.com> wrote in message
news:2a******** *************** *****@phx.gbl.. .
Hi
Relative vb.net newbie here... I have a Windows Form
application with a few subroutines in a separate module.
From one of the subroutines, I want to get the value of a
label or text box on the form. As it is, I get
a "Reference to a non-shared member requires an object
reference." error message. I can't seem to figure out how
to tell the subroutine how to find and use the labels or
text boxes on the form.
I'm sure there's an simple command I need to include,
just can't seem to find it, can someone help?
Mark D
LandAmerica Data Center - Dallas