kimosavi
Active member
Hi. I am trying to change values in all the objects on my form.
First off I call my function when the form loads
SetFonts(me)
if I write the following code on the form works:
Label1.Font = New Font(FontList.Families(0), 10)
I can even do this
Dim Lbl as label = me.Label1
Lbl.Font = New New Font(FontList.Families(0), 10)
Both work ok. What is wrong with the functions?!?
your help is hightly appreciated. Thanks!
First off I call my function when the form loads
SetFonts(me)
VB.NET:
Public Sub SetFonts(ByRef Frm As Form)
For Each Ctr As Object In Frm.Controls
ChangeFont(Ctr)
Next
End Sub
Public Sub ChangeFont(ByRef Ctr As Object)
For x As Integer = 0 To FontList.Families.Length - 1
If Ctr.Font.FontFamily.Name = FontList.Families(x).Name Then
Ctr.Font = New Font(FontList.Families(x), Ctr.Font.Size)
End If
Next
If Ctr.Controls.Count > 0 Then
For Each Itm As Object In Ctr.Controls
ChangeFont(Itm)
Next
End If
End Sub
if I write the following code on the form works:
Label1.Font = New Font(FontList.Families(0), 10)
I can even do this
Dim Lbl as label = me.Label1
Lbl.Font = New New Font(FontList.Families(0), 10)
Both work ok. What is wrong with the functions?!?
your help is hightly appreciated. Thanks!