openFileDialog1.Filter = "xlsx files (*.xlsx)|*.xlsx|xml files (*.xml)|*.xml|All files (*.*)|*.*";
openFileDialog1.FilterIndex = 1;
if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
textBox1.Text = openFileDialog1.FileName;
// От типа файла запускаем процедуру обработки
switch (openFileDialog1.FilterIndex)
{
case 1: // XLSX
parseXLSX(openFileDialog1.FileName);
break;
case 2: // XML
XmlTextReader reader = new XmlTextReader(openFileDialog1.FileName);
parseXML(reader);
break;
}
}