Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VB.Net: How to set UNDERLINE in a textbox

Posted on 2004-10-16
3
Medium Priority
?
2,442 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 1000 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 1000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

609 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