Results 1 to 3 of 3

Thread: forms.count

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2005
    Posts
    1,069

    Resolved forms.count

    Hello
    does the forms.count store the number of forms which have been loaded, or does it also include the forms which are unloaded?
    Last edited by vb_student; Jan 15th, 2005 at 08:31 PM.

  2. #2
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926

    Re: forms.count

    only the loaded forms
    Frans

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: forms.count

    Try a little experient. Open a new project, and add three or four forms. One Form1, add a list box and a command button. In the command button's click event, place this code:
    VB Code:
    1. Private Sub Command1_Click()
    2. Dim i As Integer
    3.    List1.Clear
    4.    For i = 0 To Forms.Count - 1
    5.       List1.AddItem Forms(i).Caption
    6.    Next
    7. End Sub
    Run the project and click the button. You will see one caption in the listbox and that is for Form1. Stop and project and add another command button. Put
    VB Code:
    1. Form2.Show
    in the second buttons click event, then click on the first command button again. This time, you will see, in the listbox, Form1 Form2

    .Count will only return the number of forms currently loaded, not the number of forms in your project.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width