M
Miro
I have created myself an issue, and perhaps my idea wasn't as bright as I
thought it was originally.
If someone can help me figure out what the correct train of thought should
be - or if there is a solution to this one.
I created a dummy mdi app.
In the main form ( frmMainScreen ) I created a variable as such:
<written in notepad to trim everything down>
Public Shared frmFormsOpen() As frmMyTestForm
Now, in a totally seperate sub form opend from the main form I do this on a
button click:
LengthOfGames = (frmMainScreen.frmFormsOpen.Length - 1)
ReDim Preserve frmMainScreen.frmFormsOpen(LengthOfGames)
frmMainScreen.frmFormsOpen(LengthOfGames) = New frmMyTestForm
frmMainScreen.frmFormsOpen(LengthOfGames).MdiParent = Me.MdiParent
'Remember that this form is also an mdi child of the main form.
'Set my own property for later use
frmMainScreen.frmFormsOpen(LengthOfGames).GameID = anIntegerValue
frmMainScreen.frmFormsOpen(LengthOfGames).Show()
'Works Great
So in other code on other child forms forms I can do stuff like this:
For Each SearchForm As frmMyTestForm In
frmMainScreen.frmFormsOpen
If SearchForm.GameID = mytestID Then 'mytestID is set to a
value from something else
SearchForm.BringToFront()
Exit For
End If
Next
My problem is this:
where do i actually remove the array element when the form is closed. I do
not want it to stay in the array.
I do not think I can do it in the _FormClosed of the
frmMainScreen.frmFormsOpen(LengthOfGames)._FormClosed
because I am actually in the form itself still - so I am assuming I cannot
kill the object when I am still using the object.
( im trying to kill myself from myself ).
That is my issue I have created myself and I was wondering if someone can
point me in the right direction on how to get around this issue.
Thanks,
Miro
thought it was originally.
If someone can help me figure out what the correct train of thought should
be - or if there is a solution to this one.
I created a dummy mdi app.
In the main form ( frmMainScreen ) I created a variable as such:
<written in notepad to trim everything down>
Public Shared frmFormsOpen() As frmMyTestForm
Now, in a totally seperate sub form opend from the main form I do this on a
button click:
LengthOfGames = (frmMainScreen.frmFormsOpen.Length - 1)
ReDim Preserve frmMainScreen.frmFormsOpen(LengthOfGames)
frmMainScreen.frmFormsOpen(LengthOfGames) = New frmMyTestForm
frmMainScreen.frmFormsOpen(LengthOfGames).MdiParent = Me.MdiParent
'Remember that this form is also an mdi child of the main form.
'Set my own property for later use
frmMainScreen.frmFormsOpen(LengthOfGames).GameID = anIntegerValue
frmMainScreen.frmFormsOpen(LengthOfGames).Show()
'Works Great
So in other code on other child forms forms I can do stuff like this:
For Each SearchForm As frmMyTestForm In
frmMainScreen.frmFormsOpen
If SearchForm.GameID = mytestID Then 'mytestID is set to a
value from something else
SearchForm.BringToFront()
Exit For
End If
Next
My problem is this:
where do i actually remove the array element when the form is closed. I do
not want it to stay in the array.
I do not think I can do it in the _FormClosed of the
frmMainScreen.frmFormsOpen(LengthOfGames)._FormClosed
because I am actually in the form itself still - so I am assuming I cannot
kill the object when I am still using the object.
( im trying to kill myself from myself ).
That is my issue I have created myself and I was wondering if someone can
point me in the right direction on how to get around this issue.
Thanks,
Miro