Results 1 to 2 of 2

Thread: QuicK Help Please Rich Textbox Problem!!!

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2008
    Posts
    31

    Question QuicK Help Please Rich Textbox Problem!!!

    Why doesn`t this work. Im trying to use this when getting information from a serial port it works to get info send but when it tries for the incoming it gives me an error of:

    Cross-thread operation not valid: Control 'rtfTerminal' accessed from a thread other than the thread it was created on.

    rtfTerminal is a rich textbox

    This is my code:

    Code:
            Private Sub Log(ByVal msgtype As LogMsgType, ByVal msg As String)
                rtfTerminal.SelectedText = String.Empty
                rtfTerminal.SelectionFont = New Font(rtfTerminal.SelectionFont, FontStyle.Bold)
                rtfTerminal.SelectionColor = LogMsgTypeColor(CInt(msgtype))
                rtfTerminal.AppendText(msg)
                rtfTerminal.ScrollToCaret()
            End Sub

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: QuicK Help Please Rich Textbox Problem!!!

    You can not access a control from a thread other than the one on which it was created. Take a look at this thread by jmcilhinney the subject.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

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