A1VBCode Forums

how to set font size and style for all text on from


http://www.a1vbcode.com/vbforums/Topic31993.aspx

By hlsc1983 - 6/6/2013

i have a number of radiobuttons and labels in my form form. i wish to set the same font size and style for all of them using some code. Some guidace needed here

..thanks
By Admin - 6/6/2013

Unlike with Visual Basic 6, in Visual Basic .NET, fonts are read-only at run time — you cannot set the properties directly, but you can assign a new Font object:



' Visual Basic .NET

' label1.Font = Arial Fails – property is read-only.



' Assign a Font object — Name and Size are required.

label1.Font = New System.Drawing.Font("Arial", 10)

' Assign additional attributes.

label1.Font = New System.Drawing.Font(label1.Font, FontStyle.Bold __

Or FontStyle.Italic)