0
frmCustomerDetails cd;
private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
try
{
DataGridViewRow dr = dataGridView1.SelectedRows[0];
this.Hide();
frmDairyManagementSystem cda = new frmDairyManagementSystem();
//cd.Show();
if (cd == null || cd.IsDisposed)
{
cd = new frmCustomerDetails();
cd.MdiParent = cda;
cd.WindowState = FormWindowState.Maximized;
cd.Show();
}
else
cd.Activate();
//frmCustomerDetails frm = new frmCustomerDetails();
//frm.Show();
cd.txtCustomerID.Text = dr.Cells[0].Value.ToString();
cd.dateTimePicker1.Text = dr.Cells[1].Value.ToString();
cd.txtCustomerName.Text = dr.Cells[2].Value.ToString();
cd.grpGender.Text = dr.Cells[3].Value.ToString();
cd.txtAddress.Text = dr.Cells[4].Value.ToString();
cd.txtPhone.Text = dr.Cells[5].Value.ToString();
cd.txtEmail.Text = dr.Cells[6].Value.ToString();
cd.txtMobileNo.Text = dr.Cells[7].Value.ToString();
cd.txtNotes.Text = dr.Cells[8].Value.ToString();
cd.btnUpdate.Enabled = true;
cd.btnDelete.Enabled = true;
cd.btnSave.Enabled = false;
cd.txtCustomerName.Focus();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
我想檢索我的mdi子窗體中的數據,但代碼不起作用。它不採取任何價值,我的MDI子窗體Winform c#中使用sql server的Mdi窗體2008
請幫助我如何我可以檢索數據,我的MDI子窗體