Quantcast
Channel: Can we exit the program?
Viewing all articles
Browse latest Browse all 3

Can we exit the program?

$
0
0

Hello I want to exit WPF program if something wrong. How?

privatevoid Grid_Loaded(object sender, RoutedEventArgs e)
    {
      Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
      dlg.Filter = "All Files (.test)|*.test"; // Filter files by extension// Show open file dialog box
      Nullable<bool> result = dlg.ShowDialog();// Process open file dialog box resultsif (result==false)
      {
        MessageBox.Show("The file doesn't exist");// need exit here
      }

Thanks.


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images