Results 1 to 3 of 3

Thread: same info in two textboxs

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2006
    Posts
    131

    same info in two textboxs

    i have a text in richtextbox
    if user clicked any word a popup menu will be appeared and this code will add the user's choice from that menu to the word and change its formatting


    VB Code:
    1. Private Sub mnuWord_Click(Index As Integer)  
    2.    RichTextBox1.SelColor = vbBlue
    3.    RichTextBox1.SelUnderline = True
    4.    RichTextBox1.SelText = mnuWord(Index).Caption + "  " +RichTextBox1.SelText    
    5. End Sub


    what i need is that update another textbox which is unvisible
    not the text that user is working with


    i mean that with the richtext box user can select the word show popup menu choose the option
    then that word will be in another color without any changes in the info

    and in the hidden textbox the option that user choose will be appear after the word also in different color


    how can i do this

  2. #2
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Re: same info in two textboxs

    Will this do:

    VB Code:
    1. RichTextBox2.TextRTF = RichTextBox1.TextRTF
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  3. #3
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: same info in two textboxs

    Just a quick tip. If RichTextBox2 is always hidden, it's better to use a simple String instead of a RichTextBox - it uses less memory:
    VB Code:
    1. Option Explicit
    2.     Private secondRTB As String
    3.  
    4. Private Sub RichTextBox1_Change()
    5.     secondRTB = RichTextBox1.TextRTF
    6. End Sub

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