Change Font Size of a Label

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

How can I change the font size of a label?

I have:

Label1.Font.Size = "12"

but it's telling me that property 'Size' is readonly.

Thanks,

-Dave
 
Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!,
System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))



Whenever you can't do something in code that you do in the designer, look at
how the code in the designer does it. There is nothing special going on in
the "Windows Form Designer generated code" Whatever the designer can do,
you can do too.



Hope it helps

Chris
 
Dave said:
How can I change the font size of a label?

I have:

Label1.Font.Size = "12"

but it's telling me that property 'Size' is readonly.

You will have to create a new 'Font' object with the appropriate font size:

\\\
Me.Font = _
New Font( _
Me.Font.FontFamily, _
200, _
Me.Font.Style, _
GraphicsUnit.Pixel _
)
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top