Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Other Compiled Languages (https://www.askmehelpdesk.com/forumdisplay.php?f=466)
-   -   To bind the message box to application main thread (https://www.askmehelpdesk.com/showthread.php?t=411894)

  • Nov 2, 2009, 04:34 AM
    Swati_Aggarwal
    To bind the message box to application main thread
    Hi... I have windows application (Asp.net , C#). While performing an activity I display a message box and I want that user should not be able to bypass the messagebox. Until and unless he clicks (YES or NO) he should not be able to perform any operation in application. The problem is that rights I am on a diiferent thread than the main application. So how to attach this new message box to the main application ?
  • Nov 5, 2009, 01:49 PM
    Perito

    See if this doesn't help:

    Tools for Updating Windows Forms UI from Background Threads

    Generally, you use a subroutine in the main thread and use Invoke, as shown in the link, to activate it. Put the data to be placed in the main thread in a convenient variable. If there's ever the risk that the variable will be read before it's fully written, you must protect it with a mutex or something similar.
  • Nov 5, 2009, 10:04 PM
    Swati_Aggarwal
    Thanks for the reply Perito... It would help.

  • All times are GMT -7. The time now is 05:01 AM.