473,386 Members | 1,828 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,386 software developers and data experts.

Clearing data from a DataGrid

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 problem is, when the user does a second search, the results of the first
search remain in the DataGrid, and the results of the second search are just
added below. I've tried setting the DataSource property to Nothing and
refreshing the DataGrid, but it doesn't seem to do anything.

Any help would be appreciated.

Thanks!
Mar 31 '06 #1
2 1475
Hi,

Are you clearing the dataset before you refill it?

Ken
----------
"DaveP" <Da***@discussions.microsoft.com> wrote in message
news:4E**********************************@microsof t.com...
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 problem is, when the user does a second search, the results of the
first
search remain in the DataGrid, and the results of the second search are
just
added below. I've tried setting the DataSource property to Nothing and
refreshing the DataGrid, but it doesn't seem to do anything.

Any help would be appreciated.

Thanks!

Mar 31 '06 #2
Thanks Ken. You got it exactly right. I realized I wasn't doing that, and
just came out here to "rescind" my question. Thanks for taking the time to
answer.

"Ken Tucker [MVP]" wrote:
Hi,

Are you clearing the dataset before you refill it?

Ken
----------
"DaveP" <Da***@discussions.microsoft.com> wrote in message
news:4E**********************************@microsof t.com...
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 problem is, when the user does a second search, the results of the
first
search remain in the DataGrid, and the results of the second search are
just
added below. I've tried setting the DataSource property to Nothing and
refreshing the DataGrid, but it doesn't seem to do anything.

Any help would be appreciated.

Thanks!


Mar 31 '06 #3

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...
3
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
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...
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...
8
by: cj | last post by:
I have a program to display queries to a SQL db. I type my query in a textbox and click a button and the results display in a datagrid. I could use either dataset or datatable to read the data in...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.