|
-
September 27th, 1999, 03:09 AM
#1
How to know if a form has been loaded ?
How can i know if one of the Form of the project has been loaded ?
I tried someting like
If MyForm Is Nothing Then ..
but it dosen't work
Thanks
-
September 27th, 1999, 03:42 AM
#2
Re: How to know if a form has been loaded ?
Are you using MDI forms or MDI child forms? If so, you can cycle through the forms collection to see if a specific form is loaded.
'Here's some sample code
Dim iIndex As Integer
For iIndex = 0 To Forms.Count - 1
If (Forms(iIndex).Name = "frmYourForm") Then
MsgBox Forms(iIndex).Caption
End If
Next iIndex
-
September 27th, 1999, 04:16 AM
#3
Re: How to know if a form has been loaded ?
Forms Collection is the best method.
Because VB keeps a global instance of the Form (with the same name ). So -
If MyFormName iS Nothing - will always be false, because there always exists a form by name 'MyFormName'. Typically what people do is not refer this Global form.
You could do something like this also:
dim lpForm as Form
...
set lpForm = New MyFormName
..else where
' check if an instance is loaded:
if lpForm Is nothing then
Set lpForm = New MyFormName
end if
' use the properties ..
lpForm.SomeProperty = SomeValue
RK
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
|