[VB.NET]如何清除DataGridView中的数据?

如何清除DataGridView中的数据? 如何清除DataGridView中的数据? __________________________________________________________________________ this.dataGridView1.DataSource = null; __________________________________________________________________________ 如下就可以了. DataGridView.DataSource=null; __________________________________________________________________________ Sorry! 如下就可以了. set DataGridView.DataSource=nothing __________________________________________________________________________ vb用这个 dataGridView1.DataSource = nothing __________________________________________________________________________ 这个问题是这样的,我使用dataGridView1 时,每次刷新的时候,显示的数据就变成 累加 了.我现在显示之前,先把原来的dataGridView1中的数据先清除.不知道怎么清除原有的数据 __________________________________________________________________________ 其实应该是你的datatable没有清空吧 每次刷新先清空datatable 然后再fill进datatable 最后在指定dataGridView1.DataSource=datable.Tables( Name ) __________________________________________________________________________ 如果你的数据源是一个全局表,可能会出这个问题,因为在一个表中如果不清除数据的话,认是向其中添加数据,你最好每次New出来一个表,或把原来的数据都Clear掉. __________________________________________________________________________ 可以了谢谢 __________________________________________________________________________

相关文章

Format[$] ( expr [ , fmt ] ) format 返回变体型 format$ 强...
VB6或者ASP 格式化时间为 MM/dd/yyyy 格式,竟然没有好的办...
在项目中添加如下代码:新建窗口来显示异常信息。 Namespace...
转了这一篇文章,原来一直想用C#做k3的插件开发,vb没有C#用...
Sub 分列() ‘以空格为分隔符,连续空格只算1个。对所选...
  窗体代码 1 Private Sub Text1_OLEDragDrop(Data As Dat...