我的问题是updatederogatory形式无法从Mainform调用datagridview(datagridDero)。 感谢您的帮助!private void datagridDero_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
UpdateDerogatory Derogatory = new UpdateDerogatory(ref datagridDero);
Derogatory.Show();
}
**in updateDerogatory Form**
private void UpdateDerogatory_Load(object sender, EventArgs e)
{
Mainform main = new Mainform();
string[] items = new string[main.datagridDero.Columns.Count];
for (int i = 0; i < main.datagridDero.Columns.Count; i++)
{
items[i] = datagridDero[i, datagridDero.CurrentCell.RowIndex].Value.ToString();
}
txtfirstname.Text = items[0];
loadDerogatory();
}