locked
Threading Issue RRS feed

  • Question

  • In my application, two forms, form1 and form2 are created in different thread.

    I create another form, say form3, in same thread of form1.

    When I start my application, from1 and form2 are invoked.

    There is one button on form1 to start form3 (form3.show).

     

    See following steps:

     

    1. Click button on form1, form3 is displayed(TopMost property is True).

    2. Immedietely switch to form2(diff.thread)

    3. Click title bar of form3,

    (Note: after clicking button on form1 to start form3 some processing is happening on form1.)

     

    After step 3, when processing on form1 finishes, form1 automatically comes to forground, eventhough, focus is not given to it.

     

    Can somebody tell, what could be the possible reason for this ?

    Is it the issue related to threading ?

     

    How to overcome this problem ?

    Monday, June 11, 2007 9:13 AM

Answers

  • Are you using valid cross thread operations?  Is this a VS2005 solution?  If it is written in 2003 then all bets are off - there's no telling what you've got.  If it is VS2005 then any illegal cross thread operations should throw an error.

    You also didn't say what thread the processing is happening on.  If this is a VS05 app, post more information like the routines that launch each form, launch each thread, and the long running processes involved.

    Monday, June 11, 2007 8:23 PM

All replies

  • Maybe it's just me but isn’t it a bad thing to have thread doing UI stuff?
    Monday, June 11, 2007 3:35 PM
  • Are you using valid cross thread operations?  Is this a VS2005 solution?  If it is written in 2003 then all bets are off - there's no telling what you've got.  If it is VS2005 then any illegal cross thread operations should throw an error.

    You also didn't say what thread the processing is happening on.  If this is a VS05 app, post more information like the routines that launch each form, launch each thread, and the long running processes involved.

    Monday, June 11, 2007 8:23 PM