This function will tell you if your form is loaded (instantiated) or not. If you use the form's "Visible" property to determine this, the form is instantiated if it's not already loaded. This results in the form's "Load" event being executed unnecessarily. This function has none of the above overheads...
Syntax: If IsLoaded("frmTest") Then...
True (loaded) or False (not loaded)
Submitted On | |
By | Leigh Bowers |
Level | Beginner |
User Rating | 4.3 (13 globes from 3 users) |
Compatibility | VB 4.0 (32-bit), VB 5.0, VB 6.0 |
Category | Miscellaneous |
World | Visual Basic |
Archive File |
Public Function IsLoaded(sForm As String) as Boolean
Dim Frm As Form
' Loop through the Forms collection looking
' for the form of interest...
For Each Frm In Forms
If Frm.Name = sForm Then
' Found form in the collection
IsLoaded = True
Exit For
End If
Next
End Function