Exemplo n.º 1
0
 private void btnViewData_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtFilePath.Text != "")
         {
             DataTable dt = OpenFileExcel.getDataExcelFromFileToDataTable(txtFilePath.Text);
             dt.Rows.RemoveAt(0);
             UC_ViewData   uc  = new UC_ViewData(dt);
             frmShowWindow frm = new frmShowWindow();
             frm.Controls.Clear();
             uc.Dock  = DockStyle.Fill;
             frm.Text = "Hiển thị dữ liệu";
             frm.Controls.Add(uc);
             frm.ShowDialog();
         }
         else
         {
             XtraMessageBox.Show("Bạn chưa chọn file để hiển thị");
         }
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show("" + ex.Message, "Lỗi");
     }
 }
        private void cbbSheet_SelectedIndexChanged(object sender, EventArgs e)
        {
            _dataTempView = new DataTable();
            string selectSheet = cbbSheet.Text;

            _dataTempView           = OpenFileExcel.getDataExcelFromFileToDataTable(txtPathFile1.Text, selectSheet);
            gridControl1.DataSource = _dataTempView;
        }