Practical Web Programming

Sunday, February 10, 2008

Count the Forms Loaded in a Visual Basic Project

Sometimes you want to count the forms loaded in your Visual Basic project during runtime.


This simple and ready to use function will return the number of forms loaded in a project.

Public Function FormCount() As Long
Dim frmForm As Form
For Each frmForm In Forms
FormCount = FormCount + 1
Next
End Function


To use, just call the function like this.

MsgBox "# of forms loaded: " & FormCount

0 comments:

Recent Post