Hello,
I am newbie in C# and I would like to ask a beginner question.
I have a formA where I have a datagridview, in this datagridview I added a menutrip menu. When I click on the menu item of the menutrip (Find), another form open proposing me to enter a value in order to filter my datagridview in the FormA.
This is the Code I have in the FormB (Find form)
private
void btnOK_Click(object sender, EventArgs e)
frmMAB frmBoard = new AppBrd.frmMAB();
foreach (Form frm in Application.OpenForms)
if (frm is AppBrd.frmMAB)
frm.BringToFront();
string strFilter = GetFilter(this.txtSearch.Text);
DataGridView dgv = (DataGridView)frmBoard.dgMalMbr;
DataTable)dgv.DataSource).DefaultView.RowFilter=strFilter; break;
}
}
}
I have a error telling me "System.NullReferenceException was unhandled
Message="Object reference not set to an instance of an object.."
Could someone help me on that?
Thank you in Advance,
Rangi