OpenFileDialog Event : OpenFileDialog : GUI Windows Forms C# Examples


C# Examples » GUI Windows Forms » OpenFileDialog »

 

OpenFileDialog Event








    
using  System;
using  System.Drawing;
using  System.ComponentModel;
using  System.Windows.Forms;
using  System.IO;

public  class  OpenFileDialogEvent{

        static  OpenFileDialog  openfiledlg1;
        public  static  void  Main()
        {
                openfiledlg1  =  new  OpenFileDialog();
                openfiledlg1.FileOk  +=  new  CancelEventHandler(OnFileOpenOK);
                
                openfiledlg1.Filter  =  "C#  files  (*.cs)|*.cs|Bitmap  files  (*.bmp)|*.bmp";
                openfiledlg1.FilterIndex  =  1;
                openfiledlg1.ShowDialog();
        }

        static  void  OnFileOpenOK(Object  sender,  CancelEventArgs  e)
        {
                MessageBox.Show("You  selected  the  file  "+openfiledlg1.FileName);
        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo GUI Windows Forms
» OpenFileDialog