CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    Selecting MDI Child forms

    Is there an easier way to select an MDI Child form than searching through the forms collection (For each frm in Forms)? My app contains many Child forms all based on 1 particular form. At runtime I may DIM many new forms based on this one particular form. However, When I need to send a message to the form I need to search through the collection of forms. Is there an easier way? For instance is there any way that I can change the name of an MDI child form? This way I can access it directly?

    Thanks,
    Ed...


  2. #2
    Join Date
    Sep 1999
    Location
    Red Wing, MN USA
    Posts
    312

    Re: Selecting MDI Child forms

    How are you creating the New Forms at Runtime?
    If you use:

    Dim MyNewForm As New Form1
    Then you can access the new form using the Dim'd name, eg.
    MyNewForm.Caption = "My New Form!"

    Otherwise, you could create a Global Collection and Add teh New Form to the Collection Assigning it a Unique Key which you can use to Access it later, eg.

    private MyCollection as new Collection

    private Sub Command1_Click()
    static iForm as Integer
    Dim ANewForm as new Form1

    iForm = iForm + 1
    MyCollection.Add ANewForm, "NewForm" & iForm
    With MyCollection("NewForm" & iForm)
    .Caption = "NewForm" & iForm
    .Show
    End With
    End Sub




    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]
    Aaron Young
    Senior Programmer Analyst (Red Wing Software)
    Certified AllExperts Expert

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

Featured