472,802 Members | 1,418 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,802 software developers and data experts.

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 1727
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Gary | last post by:
I have a problem with the datagrid not clearing when the datasource changes, a few fields remain on the screen and even when new data would fill those grid squares the old data remains. I wind...
3
by: Dan | last post by:
I have a C# form with an OleDBconnection, adaptor and dataset along with a several text boxes linked to the Dataset and 2 buttons. I am assigning the dataset to a DataGrid. My problem: I enter...
3
by: Brad | last post by:
I'm working with a DataGrid in C#, and the user needs to be able add and remove columns from the DataGrid on the fly, without opening and closing the form. The scenario is this. I have a setup...
5
by: Alvin Bruney | last post by:
I have a server side datagrid control. I'd like to clear the grid before the post occurs using javascript. Anybody know how to do this? It would be a similar effect to binding to a null dataset in...
1
by: Asha | last post by:
greetings, how can iclear a datagrid content?
2
by: dbuchanan | last post by:
Help me understand the behavior of this code. If I run code 1 (below) the datagrid stays populated. === incidental code === Private dataSet1 As CLIP.dsTables private Sub FillDataSet()...
1
by: amber | last post by:
Hello, What is the best method of clearing a datagrid? I'm having issues with it not 'resetting' when I want to repopulate it. I usually design my datagrids using the .net toolbar/properties, but...
2
by: DaveP | last post by:
I've got to be missing something very simple here, but I'm stumped. I have a DataGrid control on a form. The form allows search of a database and display of resulting rows in the DataGrid. My...
1
by: Neelakandan v n | last post by:
Hi, I am unable to clear column headings in datagrid in a program using vb.net 2002, framework 1.0, after clearing a set of data displayed subsequent to a query. The database is in MySql 5.0. Could...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.