Schedule function after dialog box is displayed?

Locked Schedule function after dialog box is displayed?

  • Tuesday, May 01, 2012 11:38 AM
     
     
    How does one schedule a function to run after a dialog box is displayed?

    cte677

All Replies

  • Tuesday, May 01, 2012 11:50 AM
     
     

    you can use the shown event

    http://msdn.microsoft.com/en-us/library/system.windows.forms.form.shown.aspx


    Regards,
    Ahmed Ibrahim
    SQL Server Setup Team
    This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" and "Vote as Helpful" on posts that help you.
    This can be beneficial to other community members reading the thread.

  • Tuesday, May 01, 2012 11:58 AM
     
     

    I've seen that page ... not sure how to implement. Given:

        //------------------------------
        public dlgXyz()
        {
          InitializeComponent();
          SendBytes();
        }
        //------------------------------
        //------------------------------
        private void SendBytes()
        {
          ...
        }
        //------------------------------

    SendBytes() needs to be delayed until the dlgXyz() function completes setting up the dialog box.


    cte677

  • Tuesday, May 01, 2012 12:08 PM
     
      Has Code
    private void Form1_Shown(Object sender, EventArgs e) {
    
      SendBytes();
    
    }
    Also you need to add Handle to shown event, you could do this through form designer.

    Regards,
    Ahmed Ibrahim
    SQL Server Setup Team
    This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" and "Vote as Helpful" on posts that help you.
    This can be beneficial to other community members reading the thread.

  • Tuesday, May 01, 2012 1:02 PM
     
     
    Not sure what that means ... "add Handle to shown event".  How do I do that?  I don't see that in the Properties box when I select the dialog box.

    cte677

  • Tuesday, May 01, 2012 4:45 PM
     
     Proposed Answer

    See attached screen


    Regards,
    Ahmed Ibrahim
    SQL Server Setup Team
    This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" and "Vote as Helpful" on posts that help you.
    This can be beneficial to other community members reading the thread.

  • Wednesday, May 02, 2012 11:38 AM
     
     

    Thanks for the response.  For other viewers ... as the font is very small ... the sequence is:

    Dialog Box -> Properties -> Events -> Shown ... enter a name such as "dlgXyzShown".  This leads to the creation of:

        //------------------------------
        private void dlgSyzShown(object sender, EventArgs e)
        {
        }
        //------------------------------


    cte677

  • Wednesday, May 02, 2012 12:50 PM
     
     Answered

    Hi  cte677,

    can you mark my previous post as answer ?

    Thanks


    Regards,
    Ahmed Ibrahim
    SQL Server Setup Team
    This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" and "Vote as Helpful" on posts that help you.
    This can be beneficial to other community members reading the thread.

    • Marked As Answer by cte677 Wednesday, May 02, 2012 3:26 PM
    •