Solved

VB.Net: How to set UNDERLINE in a textbox

Posted on 2004-10-16
3
2,226 Views
Last Modified: 2008-03-04
Hello experts,
in my Vb.Net windows application I want to set
for a textbox the property underline.
In VB6 the statement is
   Me.Text1.FontUnderline = True
In Vb.Net the property
   Me.Textbox1.Font.Underline = ...
does not work, because it is here ReadOnly.

If anyone knows a solution how to set Underline,
please supply related code.

   Thank you very much for every help.

   HStrix
0
Comment
Question by:HStrix
3 Comments
 

Accepted Solution

by:
KaiNikulainen earned 250 total points
ID: 12328766
Hi HStrix,
    You can set a new font to the textbox with desired properties:

    TextBox.Font = New Font(TextBox.Font, TextBox.Font.Style Or FontStyle.Underline)

Kaitsu
0
 
LVL 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 250 total points
ID: 12328768
You have to create a new Font based on the existing one but set the Underline style:

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

~IM
0
 

Author Comment

by:HStrix
ID: 12328852
Thank you both,
your code is working.

  HStrix
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question