|
-
Feb 8th, 2000, 01:16 PM
#1
Thread Starter
PowerPoster
I have an MDI form, with a few child forms. How can I tell if a specific form is showing (not loaded!). I'm not having much luck. I mean, after the Show method has been used on the form, the function returns True, after the Unload or Hide method has been used on a form, it returns False.
Thanks!
------------------
- Chris
[email protected]
Q. Why do mice have small balls?
A. Not that many know how to dance
-
Feb 8th, 2000, 01:42 PM
#2
Guru
is the .Visible property of the form not working?
-
Feb 8th, 2000, 05:04 PM
#3
Thread Starter
PowerPoster
No, i made a function, this infact.
Public Function IsOpen(ByVal strFormName As String) As Boolean
' Returns True if the specified form is open
Dim i
For i = 0 To Forms.Count - 1
If Forms(i).Caption <> "MDI Form" Then
If Forms(i).Name = strFormName Then
If Forms(i).Visible = True Then
IsOpen = True
Exit Function
End If
End If
End If
Next i
' If gets to here, form is not open
IsOpen = False
End Function
Trouble is, it don't work! Any clues anyone? Thanks,
-
Feb 9th, 2000, 01:24 AM
#4
This will return True if a given form is loaded and visible, otherwise it returns False.
Code:
Function isFormVisible(frmToCheck As String) As Boolean
Dim frm As Form
For Each frm In Forms
If frm.Name = frmToCheck Then
If frm.Visible Then
isFormVisible = True
Exit Function
End If
Else
isFormVisible = False
End If
Next
End Function
------------------
Marty
What did the fish say when it hit the concrete wall?
> > > > > "Dam!"
-
Feb 9th, 2000, 03:22 AM
#5
Thread Starter
PowerPoster
-
Feb 9th, 2000, 04:45 AM
#6
You're welcome. I just looked again at the code and I suggest you make two small changes. 1) Change Exit Function to Exit For (just in case some day you want to add more code following the For/Next loop), and 2) Add another Exit For line following isFormVisible = False.
------------------
Marty
What did the fish say when it hit the concrete wall?
> > > > > "Dam!"
-
Feb 9th, 2000, 06:02 AM
#7
Thread Starter
PowerPoster
-
Feb 9th, 2000, 12:32 PM
#8
Chris, I don't think you can get the form showing and not loaded. As soon as you show your form. it fires the Form_Load event.
------------------
Serge
Senior Programmer Analyst
[email protected]
[email protected]
ICQ#: 51055819
-
Feb 9th, 2000, 12:55 PM
#9
Thread Starter
PowerPoster
Serge, but is it possible to determin if the form is loaded and showing, not just loaded?
Sorry, perhaps I didn't make myself clear.
Thanks for trying to help anyways!
------------------
- Chris
[email protected]
Q. Why do mice have small balls?
A. Not that many know how to dance
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
|