Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 31st, 2004, 02:33 PM
Authorized User
 
Join Date: Mar 2004
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default clear dataGrid(C#)

hello
i have created datagrid. i made query and write this lines

adapter.Fill(dataSet);
dataGrid1.SetDataBinding(dataSet , "table");

but now i want to make a new query (i make always new query) and want to see the new results in datagrid but the old data is mix with new data in datagrid , how can i clear the datagrid completely and see just the new results?
thanks
koby


 
Old August 1st, 2004, 12:04 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

Well first clear ur filled DataSet & then fill it! I recoment to not change ur codes much. just add clear() before ur Fill() I mean

Code:
dataSet.table.Clear();
adapter.Fill(dataSet);
dataGrid1.SetDataBinding(dataSet , "table");
HTH.

Always:),
Hovik Melkomian.
 
Old July 17th, 2011, 06:54 AM
Registered User
 
Join Date: Jul 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It still doesn't remove previous query results.It just places "NULL" in those columns.For example if i made a query about the "firstNames" in a personal information table and executed it and then make a query about "lastNames", the first name columns is still there with all values set to "NULL" now.how can i completely empty the data grid so that it only shows the query result of currently executed query?





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to clear to datagrid? baties General .NET 1 August 29th, 2007 06:23 AM
datagrid clear all item Bluesmen VS.NET 2002/2003 2 March 8th, 2005 12:38 AM
Help me clear out Stress ! minhtri J2EE 12 November 9th, 2004 10:49 PM
do not clear dataset kasper General .NET 1 October 27th, 2004 05:41 AM
Clear Frames SeanW Classic ASP Basics 4 March 30th, 2004 02:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.