Results 1 to 3 of 3

Thread: RichText Format Bold

  1. #1

    Thread Starter
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125

    RichText Format Bold

    What is the code in the rich text format to make a certain word bold? Say I have somthing like

    (MidgetsBro) Hello
    (Bob) Hey there buddy.
    (MigetsBro) what's up?
    etc...

    How can I make the name and () bold?

    I've tried making a simple RTF document with just one word bold, but it was really confusing how much coding it added when I saved it...
    <removed by admin>

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    You can make it bold and change the color if you want.
    VB Code:
    1. Dim strWord As String
    2. Dim lPos As Long
    3.  
    4. strWord = "Hello"
    5.  
    6. lPos = InStr(1, RichTextBox1.Text, strWord, vbTextCompare)
    7.  
    8. If lPos > 0 Then
    9.     With RichTextBox1
    10.        .SelStart = lPos - 1
    11.        .SelLength = Len(strWord)
    12.        .SelColor = vbRed
    13.        .SelBold = True
    14.        .SelStart = Len(RichTextBox1.Text)
    15.     End With
    16. End If

  3. #3

    Thread Starter
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    Actually, I wanted to know the actual RTF coding. Not how to do it in a RichTextBox. I am making a chat program, and I want the names bolded, so I was thinking that I could send the formatting string along with the message. I thought it was somthing like {\b}BoldText{\b0} but I guess it isn't. I've decided to just search the string, and format it after it's received.

    Thanks anyway.
    <removed by admin>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width