README.md

December 4, 2022 ยท View on GitHub

Is Form Loaded?

Description

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...

More Info

Syntax: If IsLoaded("frmTest") Then...

True (loaded) or False (not loaded)

Submitted On
ByLeigh Bowers
LevelBeginner
User Rating4.3 (13 globes from 3 users)
CompatibilityVB 4.0 (32-bit), VB 5.0, VB 6.0
CategoryMiscellaneous
WorldVisual Basic
Archive File

Source Code

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