我有 2 个表单..gridForm
有一个dataGridView
从数据库获取数据,第二个editForm
表单textboxes
类似于gridView Columns
.
我想选择一行grid
然后单击一个编辑按钮,editForm
必须显示并且文本框具有来自网格的值
网格表格
private void dataGridView1_CellContentClick_1(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex >= 0)
{
DataGridViewRow row = dataGridView1.Rows[e.RowIndex];
// when i put this line only , it works right.
edditContactForm.edditContactNameSetter = row.Cells["contactNameGridViewColumn"].Value.ToString();
// this also with the previous is working right too.
edditContactForm.edditJobTitleSetter = row.Cells["jobTitleGridViewColumn"].Value.ToString();
// the problem appears here and the exhibition shown to this line and any similar lines under it.
edditContactForm.edditCompanyNameSetter = row.Cells["CompanyNameGridViewColumn"].Value.ToString();
}
}
编辑表格:
public string edditContactNameSetter
{
set { txtContactName.Text = value; }
}
public string edditJobTitleSetter
{
set { txtJobTitle.Text = value; }
}
public string edditCompanyNameSetter
{
set { txtCompanyName.Text = value; }
}
展览:
当我从网格中选择任何行时,展览就会出现