Results 1 to 3 of 3

Thread: activeform/MDI problem

  1. #1
    Guest

    Post

    richard has a question:
    I am using VB 5. I am writing a text editor with an MDI form. On that form is a comdo box with a list of fonts. Child forms are created at runtime, so the only way i have of identifying the current form is the activeform property. I want Activeform.text1.font.name = combo1.text. (text1 is a rich text box). However, as soon as i click on the combo, the focus is lost. I have no way of identifying the current form, i was wondering prehaps a tag - i can't give them an index, and all forms share the same name.
    People say use a variable, but what can it store? please give me some code to fix the problem.
    Thanx


  2. #2
    Member
    Join Date
    Nov 1999
    Posts
    63

    Post

    Richard,

    Use a global variable in a module as a reference to the currently active MDI child form...

    Code:
    Public gfrmActiveForm as Form
    Then add this code to the Activate event of each MDI child form...

    Code:
    Set gfrmActiveForm = Me
    Also add this code to the Unload event of each MDI child form...

    Code:
    Set gfrmActiveForm = Nothing
    Then reference the active form using your global variable...

    Code:
    If Not gfrmActiveForm Is Nothing then
        gfrmActiveForm.Text1.Font.Name = Combo1.Text
    End If
    Hope this solves your problem, Gerald M.


    [This message has been edited by Gerald (edited 12-11-1999).]

    [This message has been edited by Gerald (edited 12-11-1999).]

  3. #3
    Guest

    Post

    thanx alot it really helped

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