|
-
Oct 17th, 2001, 09:51 AM
#1
Thread Starter
Member
How to change the Font Name globally??
I have 10 forms(of course with VB controls - textbox,listbox,labels,command buttons etc) and want to know if there is a way "to change all the controls default fonts" to a different font across all Forms.
Thanx
When you TELL THE TRUTH, you don't have to REMEMBER WHAT YOU SAID !!!
-
Oct 17th, 2001, 10:59 AM
#2
New Member
I had the same problem on a project with 28 forms and there's no easy way that I could find.
If you've only used the controls that ship with VB then you might get away with doing a search and replace on your .frm files, replacing "MS Sans Serif" with "Arial", but this doesn't work in all cases. You'd have to use a text editor, not VB itself.
Bear in mind that with VB6 (maybe 5 also) if you set the font on the form before you draw any controls, all the controls will inherit the font for the form. Next time, set Arial as the font on your empty form before you start designing it.
- Andy.
-
Oct 17th, 2001, 11:12 AM
#3
Thread Starter
Member
When you TELL THE TRUTH, you don't have to REMEMBER WHAT YOU SAID !!!
-
Oct 17th, 2001, 06:44 PM
#4
PowerPoster
yeah it isnt too hard
In each form's formload event just do this
VB Code:
Private Sub Form_Load()
Dim lCtrl As Control
For Each lCtrl In Me.Controls
'Add an OR for each type of control
If TypeOf lCtrl Is TextBox Then lCtrl.FontName = "Arial"
Next
End Sub
Or if u dont mind doing Resume next u can just do this
VB Code:
Private Sub Form_Load()
Dim lCtrl As Control
On Error Resume Next
For Each lCtrl In Me.Controls
lCtrl.FontName = "Arial"
Next
End Sub
Regards
Stuart
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
|