Home  |  Index  |  Dotnet4all Snippets  |  Submit resources
About  |  Mail us  
Dotnet4all Logo
How to delete all the contents in a datagrid (Tuesday, September 14, 2004)
 

Found the following interesting discussion in the Newsgroups:

Delete all of the contents in a datagrid
by:Anonymous

I need to delete all of the contents in a datagrid before re-loading it. Please help.

Thanks.


 Reply:
by:Anonymous

 Hi Bill

What you meant by deleting all the content in the datagrid, is it clearing the datagrid or deleting the records from the database itself.

Sadha Sivam S
Malleable Minds Software Pvt Ltd


 Reply:
by:Cor Ligthert

 Hi Bill,

I assume this is a windowforms question.
A little bit in other words than Sadha said, clear the datasource (mostly
the table)

Cor


 Reply:
by:adamz5@hotmail.com (adamz5)

 
Presume the datagrid is bound to the table (test_table in e.g)

test_table.clear()

should clear the table and empty the datagrid

Regards

Adam


 Reply:
by:Anonymous

 If you just want to clear the grid without deleting any data, you can set the datasource to nothing and then restore it:

grdMyGrid.Datasource = Nothing
grdMyGrid.Refresh
grdMyGrid.Datasource = ? (name of your datasource)




Posted by Xander Zelders



 
Previous Posts
    - Build error for VB.NET but not C#
    - Comparing datareader result to a string
    - Dataviews and constrained datasources?
    - Windows service not releasing object
    - How to Shut Down Server
    - How to wrap SendMessage
    - Passing BackColor Values Between .NET and VB6 appl...
    - Scroll Richtextbox automatically
    - FileOpen file permission problem
    - TreeView

Archives
    - 08/01/2004 - 08/08/2004
    - 08/08/2004 - 08/15/2004
    - 08/15/2004 - 08/22/2004
    - 08/22/2004 - 08/29/2004
    - 08/29/2004 - 09/05/2004
    - 09/05/2004 - 09/12/2004
    - 09/12/2004 - 09/19/2004
    - 09/19/2004 - 09/26/2004
    - 09/26/2004 - 10/03/2004
    - 10/03/2004 - 10/10/2004
    - 01/02/2005 - 01/09/2005
    - 01/09/2005 - 01/16/2005
    - 01/30/2005 - 02/06/2005
    - 01/01/2006 - 01/08/2006


Disclaimer & Terms of Use  | DotNet4All.Com concept & © 2004 - 2007 by  Zelders²  - Holland