473,491 Members | 1,917 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

clearing a datagrid

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 had to
create this one programmatically (so I could add comboboxes).
I've never had this problem before, but now, whenever I try to repopulate my
dataset, it keeps my original data, and adds the column headers as new rows.
It seems to me that I just need to 'empty' the datagrid, or clear it
completely before repopulating it.
Any advice?
TIA,
Amber

Feb 22 '06 #1
1 1875
amber wrote:
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 had to create this one programmatically (so I could add
comboboxes). I've never had this problem before, but now, whenever I
try to repopulate my dataset, it keeps my original data, and adds the
column headers as new rows. It seems to me that I just need to
'empty' the datagrid, or clear it completely before repopulating it.


clear the bound data containing object, like the bound datatable, then
the grid clears itself. Be sure the object implements IBindingList, so
the grid gets an event that the bound object is cleared. So a normal
ArrayList won't do.

FB

--
------------------------------------------------------------------------
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
Feb 22 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1881
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
1724
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
15038
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
1634
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
1311
by: Asha | last post by:
greetings, how can iclear a datagrid content?
3
1757
by: Ed Bick | last post by:
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. ...
2
1952
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()...
2
1478
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
1273
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
7118
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
6980
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7364
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
5452
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3087
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1397
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
282
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.