DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2007
    Posts
    92

    DatagridView Clear

    I am using datagridview.rows.clear() to empty a grid that i am bind the rows to using the datasource and datamember properties and the error i keep getting tells that i can't clear it. is there another way to empty the grid?

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Have you tried setting the DataSource to Nothing? Or to a query that returns no records (e.g., SELECT * FROM Table WHERE 1 = 0)?
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Jan 2007
    Posts
    92
    I am trying that and it still doesn't clear the grid, the old information is still there. The table i am using to load the grid with I remove then rebuild altogher, it doesn't even always have the same columns

  4. #4
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    This seems to work for me:

    DataGridView1.DataSource = Nothing
    DataGridView1.Refresh()
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  5. #5
    Join Date
    Jul 2012
    Posts
    5

  6. #6
    Join Date
    Jul 2012
    Posts
    2
    Have you tried using the STL? There is an algorithm called next_permutation which given a range will return true on each subsequent call until all permutations have been encountered. Works not only on strings but on any "sequence" type.
    http://www.dapfor.com/en/net-suite/n...data-filtering

Similar Threads

  1. Datagridview data print in vb.net 2005 win forms
    By hellopraveen30 in forum .NET
    Replies: 0
    Last Post: 02-14-2007, 01:01 AM
  2. Replies: 0
    Last Post: 09-27-2006, 03:47 AM
  3. DataGridView Returning Values from Cells
    By triley35 in forum .NET
    Replies: 1
    Last Post: 07-08-2006, 12:34 AM
  4. updating datagridview in vb 2005
    By TigerMoonSix in forum .NET
    Replies: 1
    Last Post: 06-20-2006, 10:18 AM
  5. Submit, Clear, and Cancel buttons on an ASP.NET form
    By Aldo Sarmiento in forum ASP.NET
    Replies: 0
    Last Post: 03-01-2002, 01:26 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links