调用Clear()时,DataGridView引发NullRefernceException [英] DataGridView throws NullRefernceException when calling Clear()

查看:77
本文介绍了调用Clear()时,DataGridView引发NullRefernceException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Visual Studio 2005中使用C#. ;我的项目有一个DataGridView,其中填充了数据,因此我需要使用水平滚动条才能看到最后一列. 我有一个上下文菜单,用于清除DataGridView的内容.

I am working with C# in Visual Studio 2005.  My project has a DataGridView that is populated with data so I need to use the horizontal scroll bar to see the last column. I have a context menu to clear the contents of the DataGridView. 

如果选择clear而不滚动,则不会抛出异常

如果我滚动然后向后滚动,则不会抛出异常

但如果我滚动查看鞋s"列并选择清除,我会得到一个空引用异常

推荐答案

chiavarm,

Hi chiavarm,

您能提供一些代码供我们研究吗?

Can you provide some code for us to research?

最好的问候


这篇关于调用Clear()时,DataGridView引发NullRefernceException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆