I would like to pass a user defined class from one form to another.
There is a catch.
Form A is my main form and references a dll that contains Form B. The class that I wish to pass is a separate dll that is referenced only by Form A. This is what I have so far.
FORM A
'This is the class that I am referencing from another dll. It has several functions that I wish to use in Form B
Dim SQLConnection As UserConnectorClass = New UserConnectorClass
'This is me initiating FORM B. I pass both the current form and the class in the hopes that I can use at least one of them. I will eventually remove the one I can not.
Dim NewfrmDB As Connect.frmDB = New Connect.frmDB(Me, Me.SQLConnection)
FORM B
Public MainForm As Form
Public ConnectorClass As Object
Public Sub New(ByVal SubMainForm As Form, ByVal SubConnectorClass As Object)
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
MainForm = SubMainForm
ConnectorClass = SubConnectorClass
End Sub
I can see the SQLConnection class in the MainForm during runtime when i breakpoint however I have no idea in how to reference this class or the functions within. The form objects are available during compile time but not the SQLConnection class because it is not known at that time.
Anyone know how to do this?
There is a catch.
Form A is my main form and references a dll that contains Form B. The class that I wish to pass is a separate dll that is referenced only by Form A. This is what I have so far.
FORM A
'This is the class that I am referencing from another dll. It has several functions that I wish to use in Form B
Dim SQLConnection As UserConnectorClass = New UserConnectorClass
'This is me initiating FORM B. I pass both the current form and the class in the hopes that I can use at least one of them. I will eventually remove the one I can not.
Dim NewfrmDB As Connect.frmDB = New Connect.frmDB(Me, Me.SQLConnection)
FORM B
Public MainForm As Form
Public ConnectorClass As Object
Public Sub New(ByVal SubMainForm As Form, ByVal SubConnectorClass As Object)
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
MainForm = SubMainForm
ConnectorClass = SubConnectorClass
End Sub
I can see the SQLConnection class in the MainForm during runtime when i breakpoint however I have no idea in how to reference this class or the functions within. The form objects are available during compile time but not the SQLConnection class because it is not known at that time.
Anyone know how to do this?