here's an example in VB.NET (the method NEW is the constructor for the form)
#Region " Windows Form Designer generated code "
Dim a As String
Public Sub New(ByVal varToPass As String)
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
a = varToPass
'Add any initialization after the InitializeComponent() call
End Sub
#Region " Windows Form Designer generated code "
Dim a As String
Public Sub New(ByVal varToPass As String)
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
a = varToPass
'Add any initialization after the InitializeComponent() call
End Sub
i declared a variable in the new's paramater list and assigned it to a
private variable that is in the scope of the form only then gave it the
value of the paramater pased through the constructor
when you call this form another form you would have to do something like
this
Dim f As New Form1("text")
f.Show()
"bills" <an*******@discussions.microsoft.com> wrote in message
news:01****************************@phx.gbl...
How do you pass the value in the new form's constructor?
-----Original Message-----
Pass the value in the new form's constructor and/or set a
property of thesecond form that's public and then set it from the first
form...."Bills" <an*******@discussions.microsoft.com> wrote in
messagenews:08****************************@phx.gbl... I know this is simple but I am stumped. Trying to get the value of a TextBox from another form. Form name is
frmStart and Tbox name is tbxInis. In vb6 I could just
use frmStart.tbxInis.text but Can not figure out how to do this in .Net. Please help is easy answer
.