Solved

VB.Net: How to set UNDERLINE in a textbox

Posted on 2004-10-16
3
2,304 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 86

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

717 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