OpenFileDialog dlg = new OpenFileDialog();
if (labPath.Text != "")
dlg.FileName = labPath.Text.Split('\\').Last().ToString();
if (ImportPath == "")
{
string dir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
dlg.InitialDirectory = dir;
}
else
{
dlg.InitialDirectory = ImportPath;
}
dlg.Filter = "Microsoft Excel files(*.xls)|*.xls;*.xlsx";
// Process open file dialog box results
try
{
if (dlg.ShowDialog() == DialogResult.OK)
{
}
}