|
-
Dec 10th, 1999, 07:17 PM
#1
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
-
Dec 10th, 1999, 11:26 PM
#2
Member
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).]
-
Dec 11th, 1999, 12:44 PM
#3
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|