473,320 Members | 1,951 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Crossthread operation

I have a richtextbox that acts like a console with information on the status
of the server I am creating. I spawn new threads for each connection that is
created and would like to write the status to the console. When I try to do
that right now it gives me the error "Cross-thread operation not valid:
Control 'rtbConsole' accessed from a thread other than the thread it was
created on." Thanks in advance!s
Nov 17 '05 #1
2 7406
Benny wrote:
I have a richtextbox that acts like a console with information on the status
of the server I am creating. I spawn new threads for each connection that is
created and would like to write the status to the console. When I try to do
that right now it gives me the error "Cross-thread operation not valid:
Control 'rtbConsole' accessed from a thread other than the thread it was
created on."


Well, this is not allowed, as you might have guessed :-) One article
that explains this very well is Jon Skeet's Threading overview, here's
the link to the relevant page:

http://www.yoda.arachsys.com/csharp/...winforms.shtml

You might want to read the rest of it (switch to other pages at the
bottom) if you do a lot of threading in your app.

Oliver Sturm
--
omnibus ex nihilo ducendis sufficit unum
Spaces inserted to prevent google email destruction:
MSN oliver @ sturmnet.org Jabber sturm @ amessage.de
ICQ 27142619 http://www.sturmnet.org/blog
Nov 17 '05 #2
your form should use only the main thread
you can create as many treads as u think u need but each time u wanna write
to your richtextbox u should do it with your main thread that handle the gui

"Oliver Sturm" wrote:
Benny wrote:
I have a richtextbox that acts like a console with information on the status
of the server I am creating. I spawn new threads for each connection that is
created and would like to write the status to the console. When I try to do
that right now it gives me the error "Cross-thread operation not valid:
Control 'rtbConsole' accessed from a thread other than the thread it was
created on."


Well, this is not allowed, as you might have guessed :-) One article
that explains this very well is Jon Skeet's Threading overview, here's
the link to the relevant page:

http://www.yoda.arachsys.com/csharp/...winforms.shtml

You might want to read the rest of it (switch to other pages at the
bottom) if you do a lot of threading in your app.

Oliver Sturm
--
omnibus ex nihilo ducendis sufficit unum
Spaces inserted to prevent google email destruction:
MSN oliver @ sturmnet.org Jabber sturm @ amessage.de
ICQ 27142619 http://www.sturmnet.org/blog

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Marcus | last post by:
Hi I have a very complex sql query and a explain plan. I found there is a full table scan in ID=9 9 8 TABLE ACCESS (FULL) OF 'F_LOTTXNHIST' (Cost=84573 Card=185892...
4
by: Hardy Wang | last post by:
Hi, I have a win form application, when a button is clicked, a lengthy operation will be triggered. During the time program is still running, this application seems not to be able to response to...
0
by: John Jenkins | last post by:
Hi, any help on this would be greatly apprciated. I have been given a wsdl file from a customer generated by Oracle 10g Web Services tools. When I use wsdl.exe to attempt to produce proxy classes I...
1
by: Laurent Lequenne | last post by:
Hello There, I just converted a VS 2003 C++ Project into VS 2005. I already made some changes in my headers files, has I had compilations errors with enums declarations. Now everything compiles...
0
by: relaxedrob | last post by:
Hi All, I have a portType such as this: <portType name="CMLeJobSoapGetEmpBrand"> <operation name="EJobGetEmpBrand"> <input message="tns:EJobEmpBrdReq" name="EJobEmpBrdReq"/> <output...
8
by: Pieter | last post by:
Hi, I'm having some weird problem using the BackGroundWorker in an Outlook (2003) Add-In, with VB.NET 2005: I'm using the BackGroundWorker to get the info of some mailitems, and after each item...
6
by: Cerebrus99 | last post by:
Hi all, I'm making a Windows application that does some lengthy retrieval operations from a database and possibly from a internet resource. I want to show that the operation is going on, by...
2
by: Robinson | last post by:
I can start an Asynchronous operation against a data source with SQLCommand.BeginExecuteReader, allowing me to loop, checking for user cancellation before the operation has completed, but how then...
0
by: Default User | last post by:
I work on creating test cases for a SOAP-based set of servers, using soapUI. I received and updated set of WSDL and schema files, and when I made new tests and mock server operations, all of the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.