Solved

VB.Net: How to set UNDERLINE in a textbox

Posted on 2004-10-16
3
2,268 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

734 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