我试图打印对象(学生) 的属性之一,但是是运行错误(对象引用未设置为对象的实例) 能有人帮助我,请对象引用未设置为对象错误实例c#
while (rdStd.Read())
{
arry[counter] = new Student(Convert.ToDouble(rdStd.GetValue(0)), Convert.ToDouble(rdStd.GetValue(1)), Convert.ToDouble(rdStd.GetValue(2)));
counter++;
TextBox3.Text += arry[counter].getlon() +"" ; //here is the error
}
什么是'getlon'方法?你调试了你的代码吗? http://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and-how-do-i-fix-it –
你认为,也许你想等待+2,直到第二次作业后? –
了解如何在Visual Studio中使用调试器 - 您可以非常快速地自行解决此类问题,并且不难 –