Exception handelling in thread

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vedika
    New Member
    • Feb 2008
    • 9

    Exception handelling in thread

    hi,

    I have created a application in which there is thread for login to server.
    If exception occure while connection to server I can not catch that exception.
    What can I do.
    Please help me.
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Why can you not catch the error?
    Unless it's causing an unmanaged error, you should be able to catch all exceptions.
    You can put try/catch blocks in code that runs in its own thread.

    Comment

    • vedika
      New Member
      • Feb 2008
      • 9

      #3
      hi,
      thanks for reply.
      i got a solution from this site itself.
      if (<control>.Invo keRequired)
      {
      <control>.Invok e(new <deligate>(<fun ction>), new object[] { <parameter> });

      }

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Ahh so your problem was with unsafe thread usage (accessing GUI controls from a thread that did not create them).
        Yeah, invoke required goes a long way to handling that

        Comment

        Working...