Change font style during run time

prem_rajani

Member
Joined
Jul 19, 2005
Messages
22
Location
Coimbatore
Programming Experience
3-5
Hi,

Please can any1 help me out with changing the font style of a label. I tried it but it says read only property.
 
Hope this sample helps:
VB.NET:
[color=Blue]Dim [/color]FontName [color=Blue]As String[/color] = "Arial"
[color=Blue]Dim [/color]FontSize [color=Blue]As Integer[/color] = 14
[color=Blue]Dim [/color]FS [color=Blue]As New[/color] Font(FontName, FontSize, FontStyle.Regular)
Label1.Font = FS

If what you really want is just the FontStyle, and not the whole font setting, you can just declare a variable as FontStyle only.
 
Back
Top