C#windows应用程序,“未将对象引用设置到对象的实例。”求助

shamohai5566 shamohai5566 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我的程序代码如下:
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”
请问高手,这个问题怎么解决,大家帮忙,我是新手,谢谢!
...全文
评论 23
收藏 已收藏
分享
返回顶部
shamohai5566
C# 111,129 成员 642,539 内容