Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to underline text in Visual Basic (with Visual Studio 2010)

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?

like image 208
caro Avatar asked Sep 17 '12 13:09

caro


2 Answers

An inline answer looks like this:

Me.lbltext.Font =  New Font(lbltext.Font, FontStyle.Underline)

This would save multiple lines of code.

like image 130
wpcoder Avatar answered Sep 25 '22 22:09

wpcoder


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.

like image 22
Tony Hopkinson Avatar answered Sep 26 '22 22:09

Tony Hopkinson