예제 #1
0
        private void Bt_openfile_Click(object sender, EventArgs e)
        {
            string         fName    = string.Empty;
            OpenFileDialog openFile = new OpenFileDialog();

            openFile.InitialDirectory = "c:\\";
            openFile.Filter           = "Excel文件(*.xlsx)|*.xlsx";
            openFile.RestoreDirectory = true;
            openFile.FilterIndex      = 1;
            if (openFile.ShowDialog() == DialogResult.OK)
            {
                fName = openFile.FileName;
            }
            lb_path.Text = fName;
            ImportExcel import    = new ImportExcel();
            DataTable   dataTable = import.GetXlsDataTable(fName);

            DGV_import.DataSource = dataTable;
            Load_Choose(fName);
        }