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
Printable View
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
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.
Thanx for information.
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
RegardsVB 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
Stuart