Some days, how I yearn for the good old days of VB6.
All I want to do is set some Font properties on a label. Lo and behold, true to form, VB.Net makes what should be easy to be difficult since Bold, Italic, and Underline are read-only. So I dig and find that I can set a label to Bold like this...
Label1.Font = New Font(Label1.Font, FontStyle.Bold)
No big deal, I think. Now I want to set the label's font to Italic as well. So I run this...
Label1.Font = New Font(Label1.Font, FontStyle.Italic)
Which does indeed set the font to be Italic. However, it also removed my previously set Bold. Same with Underline. That's issue #1.
Issue #2 is that I would also like to be able to toggle Bold off. As far as I can tell, the only way to do that is to make the font to be Regular like this...
Label1.Font = New Font(Label1.Font, FontStyle.Regular)
However, once again, that will also remove any italics, underlines, etc. So what's the solution?
And lastly, there's Issue #3, where I also need to be able to change the font size of a label. Any help on these items would be greatly appreciated. Not only will you have my undying appreciation, but I just might name my firstborn after you.
All I want to do is set some Font properties on a label. Lo and behold, true to form, VB.Net makes what should be easy to be difficult since Bold, Italic, and Underline are read-only. So I dig and find that I can set a label to Bold like this...
Label1.Font = New Font(Label1.Font, FontStyle.Bold)
No big deal, I think. Now I want to set the label's font to Italic as well. So I run this...
Label1.Font = New Font(Label1.Font, FontStyle.Italic)
Which does indeed set the font to be Italic. However, it also removed my previously set Bold. Same with Underline. That's issue #1.
Issue #2 is that I would also like to be able to toggle Bold off. As far as I can tell, the only way to do that is to make the font to be Regular like this...
Label1.Font = New Font(Label1.Font, FontStyle.Regular)
However, once again, that will also remove any italics, underlines, etc. So what's the solution?
And lastly, there's Issue #3, where I also need to be able to change the font size of a label. Any help on these items would be greatly appreciated. Not only will you have my undying appreciation, but I just might name my firstborn after you.