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.Le ngth - 1)
ReDim Preserve frmMainScreen.f rmFormsOpen(Len gthOfGames)
frmMainScreen.f rmFormsOpen(Len gthOfGames) = New frmMyTestForm
frmMainScreen.f rmFormsOpen(Len gthOfGames).Mdi Parent = Me.MdiParent
'Remember that this form is also an mdi child of the main form.
'Set my own property for later use
frmMainScreen.f rmFormsOpen(Len gthOfGames).Gam eID = anIntegerValue
frmMainScreen.f rmFormsOpen(Len gthOfGames).Sho w()
'Works Great
So in other code on other child forms forms I can do stuff like this:
For Each SearchForm As frmMyTestForm In
frmMainScreen.f rmFormsOpen
If SearchForm.Game ID = mytestID Then 'mytestID is set to a
value from something else
SearchForm.Brin gToFront()
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.f rmFormsOpen(Len gthOfGames)._Fo rmClosed
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.Le ngth - 1)
ReDim Preserve frmMainScreen.f rmFormsOpen(Len gthOfGames)
frmMainScreen.f rmFormsOpen(Len gthOfGames) = New frmMyTestForm
frmMainScreen.f rmFormsOpen(Len gthOfGames).Mdi Parent = Me.MdiParent
'Remember that this form is also an mdi child of the main form.
'Set my own property for later use
frmMainScreen.f rmFormsOpen(Len gthOfGames).Gam eID = anIntegerValue
frmMainScreen.f rmFormsOpen(Len gthOfGames).Sho w()
'Works Great
So in other code on other child forms forms I can do stuff like this:
For Each SearchForm As frmMyTestForm In
frmMainScreen.f rmFormsOpen
If SearchForm.Game ID = mytestID Then 'mytestID is set to a
value from something else
SearchForm.Brin gToFront()
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.f rmFormsOpen(Len gthOfGames)._Fo rmClosed
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
Comment