473,406 Members | 2,345 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,406 software developers and data experts.

Threading error with 2005 com port

I hope this is a simple question for threading people. VB 2005 Beta2
has a new SerialPort control.

I can read the data that I want just fine. However when I try to
display the text, I get a threading error. See event code and error
message below.
How do I get around this threading error???

Private Sub SerialPort1_DataReceived1(ByVal sender As Object,
ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles
SerialPort1.DataReceived
txt = SerialPort1.ReadLine
lbData.text = txt ' <--- Get thread error here.
End Sub
Error message ------------------------
Cross-thread operation not valid: Control 'lbData' accessed from a
thread other than the thread it was created on.
---------------------------------------------

Thanks,
Gary...
-----------------------------------------------------------
Gary Kahrau - VP
ka****@monair.com (W)
Stellex Monitor Aerospace Corp.
-----------------------------------------------------------
Nov 21 '05 #1
1 1074
you'll need to marshall the call using the begin invoke. I show to how to
do this here: http://code.box.sk/newsread.php?newsid=717

"Gary Kahrau" <ka****@monair.com> wrote in message
news:do********************************@4ax.com...
I hope this is a simple question for threading people. VB 2005 Beta2
has a new SerialPort control.

I can read the data that I want just fine. However when I try to
display the text, I get a threading error. See event code and error
message below.
How do I get around this threading error???

Private Sub SerialPort1_DataReceived1(ByVal sender As Object,
ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles
SerialPort1.DataReceived
txt = SerialPort1.ReadLine
lbData.text = txt ' <--- Get thread error here.
End Sub
Error message ------------------------
Cross-thread operation not valid: Control 'lbData' accessed from a
thread other than the thread it was created on.
---------------------------------------------

Thanks,
Gary...
-----------------------------------------------------------
Gary Kahrau - VP
ka****@monair.com (W)
Stellex Monitor Aerospace Corp.
-----------------------------------------------------------

Nov 21 '05 #2

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

Similar topics

2
by: CK | last post by:
I am a "newbie" to python and today I had the need to write a program which generated a lot of tcp connections to a range of addresses (10.34.32.0/22) in order to troubleshoot a problem with a...
2
by: willie | last post by:
Hi, I'm writing a program which requires the use of three serial ports and one parallel port. My application has a scanning devices on each port, which I can access fine with pyserial. ...
11
by: Paul Sijben | last post by:
I am stumped by the following problem. I have a large multi-threaded server accepting communications on one UDP port (chosen for its supposed speed). I have been profiling the code and found...
1
by: Robert.R.Emmel | last post by:
Hello, I am using the threading module and the Queue module in python to to send out shipment tracking URL requests. Is there a way to timeout a thread within a Queue? I think the way I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.