468,306 Members | 1,138 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,306 developers. It's quick & easy.

Clearing A Datagrid

I am binding a datagrid to SQL Adapter.

I am wanting to clear it out and populate with a different data set based on
user action. I can not seem to find the equivalent to a VB6 Clear method.

Can anyone please help me with this, I'm sure very simple task.

Thanks
Nov 20 '05 #1
3 1605
Ed,
You do not clear the DataGrid itself per se, you clear & repopulate the
underlying DataTable, or you replace the DataTable with a new DataTable.

Hope this helps
Jay

"Ed Bick" <no******@comcast.net> wrote in message
news:J7********************@comcast.com...
I am binding a datagrid to SQL Adapter.

I am wanting to clear it out and populate with a different data set based on user action. I can not seem to find the equivalent to a VB6 Clear method.

Can anyone please help me with this, I'm sure very simple task.

Thanks

Nov 20 '05 #2
Like Jay mentions, call DataTable.Clear which will clear the underlying
table and then you can repopulate it. However, if you may need the data
again, then just rebind it.
"Ed Bick" <no******@comcast.net> wrote in message
news:J7********************@comcast.com...
I am binding a datagrid to SQL Adapter.

I am wanting to clear it out and populate with a different data set based on user action. I can not seem to find the equivalent to a VB6 Clear method.

Can anyone please help me with this, I'm sure very simple task.

Thanks

Nov 20 '05 #3
Hello

First clear the datatable and then :

DataGrid1.DataSource = Nothing

Kind Regards
Jorge
-----Original Message-----
I am binding a datagrid to SQL Adapter.

I am wanting to clear it out and populate with a different data set based onuser action. I can not seem to find the equivalent to a VB6 Clear method.
Can anyone please help me with this, I'm sure very simple task.
Thanks
.

Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Gary | last post: by
3 posts views Thread by Dan | last post: by
3 posts views Thread by Brad | last post: by
5 posts views Thread by Alvin Bruney | last post: by
1 post views Thread by Asha | last post: by
2 posts views Thread by dbuchanan | last post: by
1 post views Thread by amber | last post: by
2 posts views Thread by DaveP | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.