private void dtgv_XeGui_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { frmChinhSuaDanhSachXeGui frmChinhSua = new frmChinhSuaDanhSachXeGui(); frmChinhSua.txb_MaVe.Text = dtgv_XeGui.CurrentRow.Cells[0].Value.ToString(); frmChinhSua.txb_BienSo.Text = dtgv_XeGui.CurrentRow.Cells[1].Value.ToString(); if (dtgv_XeGui.CurrentRow.Cells[2].Value.ToString() == "Xe dap") { frmChinhSua.cb_LoaiXe.SelectedIndex = 0; } else if (dtgv_XeGui.CurrentRow.Cells[2].Value.ToString() == "Xe may") { frmChinhSua.cb_LoaiXe.SelectedIndex = 1; } else { frmChinhSua.cb_LoaiXe.SelectedIndex = 2; } frmChinhSua.txb_HieuXe.Text = dtgv_XeGui.CurrentRow.Cells[3].Value.ToString(); byte[] pic; pic = (byte[])dtgv_XeGui.CurrentRow.Cells[4].Value; MemoryStream picture = new MemoryStream(pic); frmChinhSua.ptb_HinhAnh.Image = Image.FromStream(picture); frmChinhSua.dtp_GioVaoBen.Value = Convert.ToDateTime(dtgv_XeGui.CurrentRow.Cells[5].Value.ToString()); frmChinhSua.dtp_NgayVaoBen.Value = (DateTime)dtgv_XeGui.CurrentRow.Cells[6].Value; if (dtgv_XeGui.CurrentRow.Cells[7].Value.ToString() == "Ve gio") { frmChinhSua.cb_LoaiVe.SelectedIndex = 0; } else if (dtgv_XeGui.CurrentRow.Cells[7].Value.ToString() == "Ve ngay") { frmChinhSua.cb_LoaiVe.SelectedIndex = 1; } else if (dtgv_XeGui.CurrentRow.Cells[7].Value.ToString() == "Ve tuan") { frmChinhSua.cb_LoaiVe.SelectedIndex = 2; } else { frmChinhSua.cb_LoaiVe.SelectedIndex = 3; } frmChinhSua.ShowDialog(this); }
private void btn_Sua_Click(object sender, EventArgs e) { frmChinhSuaDanhSachXeGui frmChinhSua = new frmChinhSuaDanhSachXeGui(); frmChinhSua.ShowDialog(this); }