private void MenuFileOpen_Click(object sender, EventArgs e)
{
if (openFileDialog.ShowDialog(this) == DialogResult.OK)
{
string filename = openFileDialog.FileName;
string extension = Path.GetExtension(filename);
if (extension == ".xls" || extension == ".xlsx")
{
ExcelReader db = new ExcelReader(filename, true, false);
TableSelectDialog t = new TableSelectDialog(db.GetWorksheetList());
if (t.ShowDialog(this) == DialogResult.OK)
{
this.sourceTable = db.GetWorksheet(t.Selection);
this.dgvAnalysisSource.DataSource = sourceTable;
this.cbTimeName.Items.Clear();
this.cbEventName.Items.Clear();
this.checkedListBox1.Items.Clear();
foreach (DataColumn col in sourceTable.Columns)
{
this.cbTimeName.Items.Add(col.ColumnName);
this.cbEventName.Items.Add(col.ColumnName);
this.checkedListBox1.Items.Add(col.ColumnName);
}
this.cbTimeName.SelectedIndex = 0;
}
}
}
}