Rs232 control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lou

    #1

    Rs232 control

    I am using the rs232 control and when I get the datareceived and try to
    assign it
    to a textbox I get some sort of thread message error

    -Lou


  • Spam Catcher

    #2
    Re: Rs232 control

    "Lou" <lou.garvin@com cast.netwrote in news:#p#tVeLpHH A.1244
    @TK2MSFTNGP04.p hx.gbl:
    I am using the rs232 control and when I get the datareceived and try to
    assign it
    to a textbox I get some sort of thread message error

    You need to marshal the call back to the GUI thread using
    'control.begini nvoke"

    Comment

    • Lou

      #3
      Re: Rs232 control

      Do you have an example?


      "Spam Catcher" <spamhoneypot@r ogers.comwrote in message
      news:Xns994317C C28D04usenethon eypotrogers@127 .0.0.1...
      "Lou" <lou.garvin@com cast.netwrote in news:#p#tVeLpHH A.1244
      @TK2MSFTNGP04.p hx.gbl:
      >
      >I am using the rs232 control and when I get the datareceived and try to
      >assign it
      >to a textbox I get some sort of thread message error
      >
      >
      You need to marshal the call back to the GUI thread using
      'control.begini nvoke"

      Comment

      • Spam Catcher

        #4
        Re: Rs232 control

        "Lou" <lou.garvin@com cast.netwrote in news:eSexhKTpHH A.1240
        @TK2MSFTNGP04.p hx.gbl:
        Do you have an example?
        >

        Private Delegate Sub UpdateControlDe legate(ByVal Text as string)

        Private Sub UpdateControl(B yval Text as String)
        If MyControl.Invok eRequired Then
        MyControl.Begin Invoke(New UpdateControlDe legate(AddressO f
        UpdateControl), new object(){Text})
        Else
        ... Do Update Here
        End If
        End Sub


        P.S. you don't need to create the delegate if you're not passing in
        parameters - in which case you can just use the built in MethodInvoker
        delegate.

        Comment

        • Lou

          #5
          Re: Rs232 control

          AWESOME!

          "Spam Catcher" <spamhoneypot@r ogers.comwrote in message
          news:Xns99438EA F52AD7usenethon eypotrogers@127 .0.0.1...
          "Lou" <lou.garvin@com cast.netwrote in news:eSexhKTpHH A.1240
          @TK2MSFTNGP04.p hx.gbl:
          >
          >Do you have an example?
          >>
          >
          >
          Private Delegate Sub UpdateControlDe legate(ByVal Text as string)
          >
          Private Sub UpdateControl(B yval Text as String)
          If MyControl.Invok eRequired Then
          MyControl.Begin Invoke(New UpdateControlDe legate(AddressO f
          UpdateControl), new object(){Text})
          Else
          ... Do Update Here
          End If
          End Sub
          >
          >
          P.S. you don't need to create the delegate if you're not passing in
          parameters - in which case you can just use the built in MethodInvoker
          delegate.

          Comment

          Working...