Filter datagridview cell click to display data onto new form
This is VS2012 Windows app. I have 2 Forms and 2 User Controls.
In SearchForm, I enter data into textboxes, filter a Search and my data values populate the datagridview just fine.
In DGV cellmousedown or cell click event, I select a row where 3 of those columns need to populate textboxes in UserControl1 and 3 columns need to populate texboxes in UserControl2. Both UserControls are embedded in CaseForm. How do I divide the 6 column values?
SearchForm.cs
private void dgvSearch_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
{
int r = e.RowIndex;
if (r > -1)
{
//Retrieve the ID
int ID = (int)dgvSearch.Rows[r].Cells["ID"].Value;
//CaseForm has both UserControl1 and UserControl2, but how to call it from here.
CaseForm caseForm = new CaseForm(ID);
caseProfileForm.MdiParent = this.MdiParent;
caseProfileForm.Show();
}
}
Please help me with code on how to filter column values on the datagridview side and into 2 User Controls, and where would I put it? Do I add it in the CaseForm_Load or in the UserControl method somewhere? Thank you in advance.