Solved

Formatting only a part of a strings Font Bold

Posted on 2004-10-14
4
407 Views
Last Modified: 2013-12-03
I have text that is added to a textbox and I want to BOLD only a certain section of the string.
Example:
(1,000) .... One Thousand

I just want the 1,000  font bolded

the code is as followes:

Text3.text = Text3.text & "(" & Label3.Caption & ")" & Text2.text VbCrLf

The Label3.Caption is the Number (1,000) the Text2.text is that number convert to a text form and as the user enters more numbersto be converted it adds them to to the next line of the textbox.

Should I use a Listbox instead of a text box?

I would like to make the Number (Label3.Caption) Font Bold so that it stands out.

Thanks.....
0
Comment
Question by:ucla11
  • 3
4 Comments
 
LVL 4

Expert Comment

by:eozz_2000
ID: 12313177
I would use a RichTextBox
0
 
LVL 4

Accepted Solution

by:
eozz_2000 earned 250 total points
ID: 12313326
For example:

        Me.rttTextBox.Text = "This is my rich text box" & vbCrLf
        Me.rttTextBox.Text &= "1000" & vbCrLf
        Me.rttTextBox.Text &= "After the number"

        Me.rttTextBox.SelectionStart = Me.rttTextBox.Text.IndexOfAny("1000")
        Me.rttTextBox.SelectionLength = CStr("1000").Length
        Me.rttTextBox.SelectionFont = New Font(Me.rttTextBox.Font.Name, Me.rttTextBox.Font.Size, FontStyle.Bold)

You must select the number in your richTextBox control and then aply it a bold font.
0
 
LVL 4

Expert Comment

by:eozz_2000
ID: 12315828
Well... where are you?
0
 

Author Comment

by:ucla11
ID: 12316043
Sorry I quess I asked the same question twice in the same category I accepted your anwser in the other post as well....Sorry
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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

820 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