I have a problem with underline text after press a button in Visual Basic. I'm using Visual Studio 2010 and I red in tutorial that in button method I have to use for example:
lbltext.FontUnderline = True
But I don't have variable "FontUnderline". Of course I was trying to find other variable or function to do this but without success. Anyone know how to do this in Visual Studio?
An inline answer looks like this:
Me.lbltext.Font = New Font(lbltext.Font, FontStyle.Underline)
This would save multiple lines of code.
Or the old way of doing it was to instance a new font
Font standardFont = new Font(lblText.Font)
Font underFont = new Font(standardFont,FontStyle.Underline)
Then just set the Font property of the relevant controls to the one you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With