locked
using rich text box RRS feed

  • Question

  • hello

    i just started learning  visual basic and i need some information

    i am using rich test box to input some text

    say like"RED   BLUE   GREEN"

    i want the Rich text box to automatically change

    RED to red colour

    BLUE to blue colour

    GREEN to green colour....

    can this be done???

     

    Friday, December 23, 2011 5:44 PM

Answers

  • Hi Tejashs,

             try this below samples thread. I hope this will help.

    http://stackoverflow.com/questions/5399208/vb-net-multicolor-richtextbox

    http://www.codeproject.com/KB/cpp/richtextboxhs.aspx

     


    If my answer solve your problem,Please click "Mark As Answer" on that post and "Mark as Helpful". Manikandan
    • Proposed as answer by Mike Feng Tuesday, December 27, 2011 10:09 AM
    • Marked as answer by Mike Feng Tuesday, January 3, 2012 1:04 PM
    Friday, December 23, 2011 5:57 PM
  • You can also refer following link

    http://social.msdn.microsoft.com/forums/en-US/vbgeneral/thread/afee34bc-25ab-405c-ab7e-863654ae4307


    Gaurav Khanna | Microsoft VB.NET MVP
    • Proposed as answer by Mike Feng Tuesday, December 27, 2011 10:10 AM
    • Marked as answer by Mike Feng Tuesday, January 3, 2012 1:04 PM
    Friday, December 23, 2011 6:41 PM
  • Hi Tejashs,

                   Check with the below code you can the pass the richtextbox text by the textbox at runtime.

    try this sample. Hope this will help you.

     Private Sub Update_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Update.Click
            RichTextBox1.Text = String.Empty
            RichTextBox1.SelectionFont = New Font("Microsoft Sans Serif", 8.25, FontStyle.Bold)
            RichTextBox1.SelectionColor = Color.Green
            RichTextBox1.SelectedText = TextBox1.Text
            RichTextBox1.Text = RichTextBox1.Text
    
        End Sub



     


    If my answer solve your problem,Please click "Mark As Answer" on that post and "Mark as Helpful". Manikandan

    • Edited by Manikandan J Friday, December 23, 2011 7:10 PM
    • Proposed as answer by Mike Feng Tuesday, December 27, 2011 10:10 AM
    • Marked as answer by Mike Feng Tuesday, January 3, 2012 1:04 PM
    Friday, December 23, 2011 7:09 PM

All replies

  • Hi Tejashs,

             try this below samples thread. I hope this will help.

    http://stackoverflow.com/questions/5399208/vb-net-multicolor-richtextbox

    http://www.codeproject.com/KB/cpp/richtextboxhs.aspx

     


    If my answer solve your problem,Please click "Mark As Answer" on that post and "Mark as Helpful". Manikandan
    • Proposed as answer by Mike Feng Tuesday, December 27, 2011 10:09 AM
    • Marked as answer by Mike Feng Tuesday, January 3, 2012 1:04 PM
    Friday, December 23, 2011 5:57 PM
  • Hi, tej Welcome To MSDN forums

    Sample:

    Insert first snippet of text, with default formatting RichTextBox1.Text = "This is black " 
     ' Move the insertion point to the end of the line 
    
    RichTextBox1.Select(RichTextBox1.TextLength, 0) 
     'Set the formatting and insert the second snippet of text 
    
    RichTextBox1.SelectionFont = New Font(RichTextBox1.Font, FontStyle.Bold)
     RichTextBox1.SelectionColor = Color.Green RichTextBox1.AppendText("[BOLD GREEN]")
      ' Revert the formatting back to the defaults, and add the third snippet of text 
    
    RichTextBox1.SelectionFont = RichTextBox1.Font
    
     RichTextBox1.SelectionColor = RichTextBox1.ForeColor RichTextBox1.AppendText(" black again")
    
    

    By
    A Pathfinder.
    JoSwa



    If you find an answer helpful, click the helpful button. If you find an answer to your question, mark it as the answer.
    Friday, December 23, 2011 6:34 PM
  • You can also refer following link

    http://social.msdn.microsoft.com/forums/en-US/vbgeneral/thread/afee34bc-25ab-405c-ab7e-863654ae4307


    Gaurav Khanna | Microsoft VB.NET MVP
    • Proposed as answer by Mike Feng Tuesday, December 27, 2011 10:10 AM
    • Marked as answer by Mike Feng Tuesday, January 3, 2012 1:04 PM
    Friday, December 23, 2011 6:41 PM
  •  in this

    http://stackoverflow.com/questions/5399208/vb-net-multicolor-richtextbox

    the assignment to realtextbox is is done inside the program.... but i want it to change when i type it when debugging...


     i was hoping something more like searching the rich text box then if any instance of "RED" is found it must change color to red..
    • Edited by tejashs Friday, December 23, 2011 7:17 PM
    Friday, December 23, 2011 6:52 PM
  • Hi Tejashs,

                   Check with the below code you can the pass the richtextbox text by the textbox at runtime.

    try this sample. Hope this will help you.

     Private Sub Update_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Update.Click
            RichTextBox1.Text = String.Empty
            RichTextBox1.SelectionFont = New Font("Microsoft Sans Serif", 8.25, FontStyle.Bold)
            RichTextBox1.SelectionColor = Color.Green
            RichTextBox1.SelectedText = TextBox1.Text
            RichTextBox1.Text = RichTextBox1.Text
    
        End Sub



     


    If my answer solve your problem,Please click "Mark As Answer" on that post and "Mark as Helpful". Manikandan

    • Edited by Manikandan J Friday, December 23, 2011 7:10 PM
    • Proposed as answer by Mike Feng Tuesday, December 27, 2011 10:10 AM
    • Marked as answer by Mike Feng Tuesday, January 3, 2012 1:04 PM
    Friday, December 23, 2011 7:09 PM