Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. problem with serial port and cross threads

problem with serial port and cross threads

Scheduled Pinned Locked Moved Visual Basic
csharpdatabasecomhelp
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rey9999
    wrote on last edited by
    #1

    Hello Everyone. i have done an application in vs2005 who reads some input from a barcode scanner, displays the string read by the barcode on a textbox, updates a database and shows the results on some datagridviews. the barcode scanner is attached to a COM port. my problem is that when i attempt to process the data read (using the SerialPort.DataReceived event), i get a cross thread invalid operation exception (it says it can't access the textbox, because it's a different thread from the one who created it). if i try to set the control.CheckForIllegalCrossThreadCalls property to false, i can write text on the textbox, but my application locks up as it tries to do other things as refreshing datagrids or showing other forms. Please understand i have very little knowledge of VB.NET 2005. is there a simple way to solve this? Thanks in advance.

    ~~~ From Milano to The Hague, easy as it goes ~~~

    R 1 Reply Last reply
    0
    • R Rey9999

      Hello Everyone. i have done an application in vs2005 who reads some input from a barcode scanner, displays the string read by the barcode on a textbox, updates a database and shows the results on some datagridviews. the barcode scanner is attached to a COM port. my problem is that when i attempt to process the data read (using the SerialPort.DataReceived event), i get a cross thread invalid operation exception (it says it can't access the textbox, because it's a different thread from the one who created it). if i try to set the control.CheckForIllegalCrossThreadCalls property to false, i can write text on the textbox, but my application locks up as it tries to do other things as refreshing datagrids or showing other forms. Please understand i have very little knowledge of VB.NET 2005. is there a simple way to solve this? Thanks in advance.

      ~~~ From Milano to The Hague, easy as it goes ~~~

      R Offline
      R Offline
      Rey9999
      wrote on last edited by
      #2

      I solved the problem, i discovered the magic world of delegates. :) Thanks anyway to everyone who read this message and thought of a solution for me.

      ~~~ From Milano to The Hague, easy as it goes ~~~

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups