By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,463 Members | 2,954 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,463 IT Pros & Developers. It's quick & easy.

Change Font Size of a Label

P: n/a
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
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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" <no****@yahoo.com> wrote in message
news:e3**************@TK2MSFTNGP11.phx.gbl...
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

Nov 21 '05 #2

P: n/a
"Dave" <no****@yahoo.com> schrieb:
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 _
)
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.