By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,573 Members | 1,812 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,573 IT Pros & Developers. It's quick & easy.

Detect if MDI is open

P: n/a
Hi,
how can I detect if an MDI is already open or not in order to prevent it
from being opened again.

How can I bring the MDI form to the TOP from the parent window.
If I do a
Dim myChildForm1 As New frmForm1()
myChildForm1.MdiParent = Me
myChildForm1.Show()

to startup the form in a Sub of the parent then i supposed I need to
store the reference somehow in order to access it later from a different
or even the same sub.

Can anyone give me a hand on that ?

Thanks

A

Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi A,

I gues you want to check if a 'Child' is open. (an MDI is the container-form
(parent))
I think the best practice is to create an accessible variable.
Look at the folowing code (you can put this in a genaral module)

If IsNothing(ChildForms.myChildForm1) Then

ChildForms.myChildForm1= New frmForm1

With ChildForms.myChildForm1

.MdiParent = ChildForms.frmMDI.ActiveForm

.Show()

.WindowState = wState

.StartPosition = FormStartPosition.CenterParent

End With

Else

' Child is instanciated so bring it back to top

ChildForms.myChildForm1.Activate()

End If

'Childforms' in this case is a "Shared Class". You can do the trick also
with 'plain' variables.
I use these classes because of readability and ease of use (eg:
intellisense)

HTH,

Michael
"alex" <ai******@hotmail.com> wrote in message
news:eq**************@TK2MSFTNGP12.phx.gbl...
| Hi,
| how can I detect if an MDI is already open or not in order to prevent it
| from being opened again.
|
| How can I bring the MDI form to the TOP from the parent window.
|
|
| If I do a
| Dim myChildForm1 As New frmForm1()
| myChildForm1.MdiParent = Me
| myChildForm1.Show()
|
| to startup the form in a Sub of the parent then i supposed I need to
| store the reference somehow in order to access it later from a different
| or even the same sub.
|
| Can anyone give me a hand on that ?
|
| Thanks
|
| A
|
Nov 20 '05 #2

P: n/a
* alex <ai******@hotmail.com> scripsit:
how can I detect if an MDI is already open or not in order to prevent
it from being opened again.


<http://groups.google.de/groups?selm=u5iBdcHRDHA.1552%40TK2MSFTNGP10.phx.gb l>

--
Herfried K. Wagner
MVP VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.