C#windows应用程序,“未将对象引用设置到对象的实例。”求助
我的程序代码如下:
baseclass.Userclass uc = new testCfor2.baseclass.Userclass();
string strOperater = uc.UsingName(strUserName);
string strTime = Convert.ToString(System.DateTime.Now);
for (int i = 0; i < j-1; i++)
{
//int a;
string IsGood="";
IsGood =this.dataGridView1.Rows[i].Cells[7].Value .ToString ();
if (IsGood .Equals("合格"))
{
int strReordId = Convert.ToInt32(this.dataGridView1.Rows[i].Cells[0].Value);
string strYorN = "合格";
string strDitail;
strDitail = this.dataGridView1.Rows[i].Cells[8].Value.ToString ();
baseclass.Checkclass chcalss = new testCfor2.baseclass.Checkclass();
chcalss.CheckRecordAdd(strReordId, strOperater, strYorN, strTime, strDitail);
}
if (IsGood.Equals("不合格"))
{
int strReordId = Convert.ToInt32(this.dataGridView1.Rows[i].Cells[0].Value);
string strYorN = "不合格";
string strDitail="";
strDitail= this.dataGridView1.Rows[i].Cells[8].Value.ToString().Trim ();
baseclass.Checkclass chcalss = new testCfor2.baseclass.Checkclass();
chcalss.CheckRecordAdd(strReordId, strOperater, strYorN, strTime, strDitail);
}
}
调试运行后,弹出对话框提示错误,“未将对象引用设置到对象的实例。”“未处理NullReferenceException”
请问高手,这个问题怎么解决,大家帮忙,我是新手,谢谢!