Wednesday, 25 May 2016

Displaying FileDialog Box~ mkniit

OpenFileDialog openFileDialog1 = new OpenFileDialog();

openFileDialog1.InitialDirectory = "c:\\" ;
openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*" ;
openFileDialog1.FilterIndex = 2 ;
openFileDialog1.RestoreDirectory = true ;

if(openFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
if ((myStream = openFileDialog1.OpenFile()) != null)
{

}
}
catch (Exception ex)
{
MessageBox.Show("Un-Expected Error : " + ex.Message);
}
}
}

No comments:

Post a Comment