|
-
May 22nd, 2003, 08:25 PM
#1
Thread Starter
Hyperactive Member
Checking for Instance of Form - RESOLVED
hi,
i have a MdiParent form that creates a new instance of another form and it display and naturally it is an MDIChild. Really simple stuff.
the problem is that I have a timer on the MDIParent that does stuff (naturally ) and this causes problems with the MDIChild.
What I would like to do, is inside the MDIParent's Timer control, place a check in there to see "if this particular MDIChild form is open, then don't execute this".
is there a simple way to do this? (does this make sense?)
thanks all
Last edited by stingrae; May 26th, 2003 at 11:56 PM.
"The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.
Windows & Web Developer
Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
Sutherland Shire, Sydney Australia
www.stingrae.com.au
Developer of Arnold - Gym & Martial Arts Database Management System
www.gymdatabase.com.au
-
May 22nd, 2003, 09:02 PM
#2
Fanatic Member
You could examine the MDIChildren array of the parent form and see if your child form is in it...
-
May 22nd, 2003, 09:18 PM
#3
Thread Starter
Hyperactive Member
Slow_Learner,
thanks - nice idea! i never thought of that.
in my mind, i know exactly what you mean - i.e. create a For loop and check the name etc...
but how do i code it? i can't find anything in help about MdiParent being an arry. is it a "For Each x in Y" or is it "For x - 0 to Parent.Count" style of loop?
are you able to paste the basic for...loop structure?
cheers
"The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.
Windows & Web Developer
Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
Sutherland Shire, Sydney Australia
www.stingrae.com.au
Developer of Arnold - Gym & Martial Arts Database Management System
www.gymdatabase.com.au
-
May 23rd, 2003, 03:13 AM
#4
Fanatic Member
Ought to be something like
VB Code:
Dim frmFoo As Form
For Each frmFoo In frmParent.MDIChildren
If frmFoo.Name = "Something" Then
'Do some stuff
End If
Next
Post if it gives you problems, I haven't actually tried this but it should work.
-
May 26th, 2003, 03:40 PM
#5
Frenzied Member
or you could set a flag if the child form is open...just dump this in the parent
VB Code:
Dim blnFound As Boolean = False
Dim frmChild As Form
For Each frmChild In Me.MdiChildren
If TypeOf frmChild Is frmChoose Then
frmChild.Focus()
blnFound = True
Exit For
End If
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
May 26th, 2003, 11:49 PM
#6
Thread Starter
Hyperactive Member
they both worked.
thanks guys!
"The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.
Windows & Web Developer
Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
Sutherland Shire, Sydney Australia
www.stingrae.com.au
Developer of Arnold - Gym & Martial Arts Database Management System
www.gymdatabase.com.au
-
May 27th, 2003, 12:33 PM
#7
Fanatic Member
Using TypeOf like EyeTalion suggests is probably much better than using .Name. Glad it's fixed!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|