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

Determine the font style of a label control

P: 9
Hello All,

Does anyone know how to capture and save the font style of a label control.
(FontStyle.Bold, FontStyle.Italic, FontStyle.Underline)

I need to be able to save the font style and have it reapplied when I reopon my form.

I know how to "reapply" it when I open the form again. I just need help getting the original value for saving purposes.

Thanx in advance for any help.
Jun 17 '10 #1

✓ answered by ThatThatGuy

@sly9er
Capture and store the font of the Label using Label.Font...

Then you can determine the styles of the font such as using FontObject.FontFamily

To get the style you can check for underline FontObject.Underline

something like that

Share this Question
Share on Google+
6 Replies


P: 9
No takers?
Jun 17 '10 #2

ThatThatGuy
Expert 100+
P: 449
@sly9er
Capture and store the font of the Label using Label.Font...

Then you can determine the styles of the font such as using FontObject.FontFamily

To get the style you can check for underline FontObject.Underline

something like that
Jun 18 '10 #3

P: 9
ThatThatGuy,

YOU ARE THE MAN!!!

I have been searching on this topic for 3 days.

Thank you so much!

So if anyone else is having this issue, here is the fix.

Get the style propertie after after the font dialog button click. (OK or Cancel).

If FontDialog1.Font.Underline = True Then
MsgBox("underline")// replace this with your own process
End If

This was so elusive, but now I can us it for Bold, Underline, Italic, Strikout, and all the possible combinations.

Sweet. Now I can complete my script.

Whoo Hoo!
Jun 18 '10 #4

ThatThatGuy
Expert 100+
P: 449
@sly9er
You got the answer and you posted your answer as the best answer ... strange
Jun 19 '10 #5

P: 9
Oops,

Sorry about that. Not sure how I made that mistake.

Is there a way I can switch it to your answer?
Jun 19 '10 #6

ThatThatGuy
Expert 100+
P: 449
@sly9er
ya you've done that
Jun 19 '10 #7

Post your reply

Sign in to post your reply or Sign up for a free account.