VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Is Form Loaded?

by Leigh Bowers (6 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (3 Votes)

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

Inputs
Syntax: If IsLoaded("frmTest") Then...
Code Returns
True (loaded) or False (not loaded)

Rate Is Form Loaded?

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

Download this snippet    Add to My Saved Code

Is Form Loaded? Comments

No comments have been posted about Is Form Loaded?. Why not be the first to post a comment about Is Form Loaded?.

Post your comment

Subject:
Message:
0/1000 characters