How do I pass a parameter from my form #1 (txtDate) to frmDataGrid?
There are two ways to do this. One way to do this is to modify your frmDataGrid's constructor. Another way is to add a Public member to frmDataGrid, and after you instantiate it, set the value.
I'll show you the first way. Add a parameter to the constructor. If you did not define a constructor, you need to add one.
So if you wanted to pass a String for example, do this in frmDataGrid:
-
-
Private paramS as String
-
-
Public Sub New(s as String)
-
' This call is required by the Windows Form Designer.
-
InitializeComponent()
-
-
' Add any initialization after the InitializeComponent() call.
-
paramS = s
-
End Sub
-
And you would have to change the way you call the form:
-
Dim form as New frmDataGrid("whatever string you want to pass")
-
form.Show()
-