本文介绍了Datagridview.datasource = datatable;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的代码中,每件事情都很好......当我执行此语句时,它显示错误



对象引用未设置为实例一个对象。



并显示异常NullReferenceException ....



请帮忙我...

提前致谢....

In my code every thing is good...When I am executing this statement it showing the error

Object reference not set to an instance of an object.

and showing an exception NullReferenceException....

please help me...
Thanks in advance....

推荐答案


private void button5_Click(object sender, EventArgs e)
        {
           string str = comboBox1.SelectedValue.ToString();
            Form6 f6 = new Form6();
            f6.Perform(str);
            f6.Show();
        }





当我使用此代码时,它没有任何错误....







When i Used this Code it is not having any error....


private void button5_Click(object sender, EventArgs e)
        {
           string str = comboBox1.SelectedValue.ToString();
            Form6 f6 = new Form6(str);
            f6.Perform(str);
            f6.Show();
        }
</pre>





当我使用此代码时显示错误....

这里perform()在form6中显示一个daatabase



When i used this code it showing the error....
here perform() display a daatabase in form6


这篇关于Datagridview.datasource = datatable;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 20:05