473,399 Members | 3,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 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 1754
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.