J
Jim Shank
I am really trying to find the best OOP way of doing this. I have a
parent MDI form with multiple children and I am trying to communicate
variables between them. I have been able to successfully get the
parent form to read the child variable by using a Public Property in
one of my child forms like such:
Public ReadOnly Property ID() As String
Get
Return strID
End Get
End Property
When this value is updated I am having the child use the RaiseEvent to
get the parent form to then read this Property from the Child window:
strID = lstExistingID.SelectedItems(0).Text
RaiseEvent IDSelected()
Private Sub ChildFRM_IDSelected() Handles frmChild.IDSelected
strID = frmChild.ID
End Sub
The problem I am running into is now retrieving this variable from my
parent to a different child. It seems that I have to declare or
somehow define the form for the MDI Parent in order to access its
properties/functions. I can successfully create a reference in the
other child form using:
Dim frmMainMDIParent As fclsMainMDIParent
but as soon as I uncomment my Property get statement:
lstTransactionLog.Items.Add("Ready to process ID " &
frmMainMDIParent.ID)
I start getting an exception: An unhandled exception of type
'System.OutOfMemoryException' occurred in system.windows.forms.dll
Additional information: Error creating window handle.
From Main MDI Parent Form:
If e.Button Is tbbTransactionControl Then
frmTransactionControl.MdiParent = Me
If Not frmTransactionControl.Visible Then
stops here----> frmTransactionControl.Show()
End If
End If
I hope this provides enough information for someone to give me a
solution. I am also interested in any suggested reference sites/books
to show me the best way to handle inter-MDI communication. TIA!
parent MDI form with multiple children and I am trying to communicate
variables between them. I have been able to successfully get the
parent form to read the child variable by using a Public Property in
one of my child forms like such:
Public ReadOnly Property ID() As String
Get
Return strID
End Get
End Property
When this value is updated I am having the child use the RaiseEvent to
get the parent form to then read this Property from the Child window:
strID = lstExistingID.SelectedItems(0).Text
RaiseEvent IDSelected()
Private Sub ChildFRM_IDSelected() Handles frmChild.IDSelected
strID = frmChild.ID
End Sub
The problem I am running into is now retrieving this variable from my
parent to a different child. It seems that I have to declare or
somehow define the form for the MDI Parent in order to access its
properties/functions. I can successfully create a reference in the
other child form using:
Dim frmMainMDIParent As fclsMainMDIParent
but as soon as I uncomment my Property get statement:
lstTransactionLog.Items.Add("Ready to process ID " &
frmMainMDIParent.ID)
I start getting an exception: An unhandled exception of type
'System.OutOfMemoryException' occurred in system.windows.forms.dll
Additional information: Error creating window handle.
From Main MDI Parent Form:
If e.Button Is tbbTransactionControl Then
frmTransactionControl.MdiParent = Me
If Not frmTransactionControl.Visible Then
stops here----> frmTransactionControl.Show()
End If
End If
I hope this provides enough information for someone to give me a
solution. I am also interested in any suggested reference sites/books
to show me the best way to handle inter-MDI communication. TIA!