Results 1 to 3 of 3

Thread: Highlighted text...

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2003
    Posts
    3

    Highlighted text...

    Hi again.

    I have a standard multi-line text box. I also have "B" command button, representing "Text Bold"

    What I want to happen is the user highlights some text they've typed into my multi-line text box and then clicks B it adds <B> just before the start of their highlighting and </B> just after. I don't actually want the text to go bold... as it gets posted to a website.

    I don't have the slightest idea of how to do this, could anyone help?

    Thanks!
    Jonathan.

  2. #2
    Addicted Member
    Join Date
    Sep 2003
    Posts
    227
    maybe this can help ...

    Code:
            Dim str As String = TextBox1.Text
            Dim SelectedStr = "<B>" & TextBox1.SelectedText & "</B>"
            Dim startpos As Integer = TextBox1.SelectionStart
    
            str = str.Remove(startpos, TextBox1.SelectionLength)
            str = str.Insert(startpos, SelectedStr)
    
            TextBox1.Text = str

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2003
    Posts
    3
    Thanks! That worked perfectly!


    J.

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