openFiledialog cancel event

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sarabonn
    New Member
    • Nov 2008
    • 69

    openFiledialog cancel event

    Hallo everyone,

    Iam using a openFiledialog to open when a click a button. If i click the cancel button in the openFiledialog how can capture that event ?..

    Thank you.
  • PRR
    Recognized Expert Contributor
    • Dec 2007
    • 750

    #2
    Originally posted by sarabonn
    Hallo everyone,

    Iam using a openFiledialog to open when a click a button. If i click the cancel button in the openFiledialog how can capture that event ?..

    Thank you.
    Try this
    Code:
    System.Windows.Forms.DialogResult myResult;
                myResult=openFileDialog1.ShowDialog();
    int i = Convert.ToInt32(DialogResult.Cancel);
    if (myResult==DialogResult.Cancel) 
                {
                    MessageBox.Show("Specify file");
                    
                }

    Comment

    Working...