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);
}
}
|