Powered By Blogger

Monday, November 9, 2009

openFileDialog c#

OpenFileDialog openFileDialogX = new OpenFileDialog();
string Fname, Fext,fpath ;
int Fsize;

private void GetOpenFileDialog()
{
openFileDialogX.CheckPathExists = true;
openFileDialogX.Filter = "Image Files (*.bmp;*.jpg;*.jpeg)|*.bmp;*.jpg;*.jpeg|" + "PNG files (*.png)|*.png|text files (*.text)|*.txt|doc files (*.doc)|*.doc|pdf files (*.pdf)|*.pdf|excel files(*.xls)|*.xls|excel files07(*.xlsx)|*.xlsx";
openFileDialogX.Multiselect = false;
openFileDialogX.AddExtension = true;
openFileDialogX.ValidateNames = true;
openFileDialogX.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
openFileDialogX.ShowDialog();
fpath = openFileDialogX.FileName.ToString();
fname=System.IO.Path.GetFileName(openFileDialogX.FileName).ToUpper();
Fsize = openFileDialogX.FileName.Length;
Fext = System.IO.Path.GetExtension(Fname);
}

No comments:

Post a Comment