在dev express grid控件中清除所有列和行 [英] Clear all Columns and row in a dev express grid control

查看:1163
本文介绍了在dev express grid控件中清除所有列和行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的窗口应用程序(VS2005)中有一个datagridview和一个dev express gridcontrol,在我的datagridview中有
我有来自我的数据库(SQL)的所有表。因此,当我双击datagridview中的表时,该特定表中的所有数据都显示为gridcontrol。

我的问题是devexpress gridcontrol不会清除之前的querry,所以不要只显示选中的表,它显示所有以前选择的表。我尝试使用:

I have a datagridview and a dev express gridcontrol in my window application (VS2005) ,
in my datagridview i have all the tables from my Database (SQL) . So when i double click a table in the datagridview all the data in that particular table is shown the gridcontrol.
My problem is that the devexpress gridcontrol does not clear the previous querry , so instead of showing only the selected table , it shows all the previous selected tables. I tried using :

gridControl1.DataSource = null;
              gridView1.Columns.Clear();





但它不起作用。

可以有人请帮助我...我对C#很新,所以我不知道如何解决我的问题。



谢谢: - )



but it does not work.
Can somebody please help me...I'm very new to C# so i ve no idea how to solve my problem.

Thanks :-)

推荐答案

试试这个,

try this,
gridControl1.DataSource = null;
gridControl1.DataBind();





我自己尝试一下:)



I try this myself :)


while (gridView1.RowCount!=0)
            {
                gridView1.SelectAll();
                gridView1.DeleteSelectedRows();
            }


这篇关于在dev express grid控件中清除所有列和行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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