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

how to clear a datagridview in vb.net

2
After I have filled my datagridview I want to clear it up when the options for the query changes.
I know how to clear the fields but I don't know how to clear the rows, so the datagridview appears as it does when you run the program the first time.
Thanks for your help.
Ricky
Jul 26 '07 #1
4 14741
Plater
7,872 Expert 4TB
If you bind the datasource to null, it will clear EVERYTHING.

Are you wanting to remove all the rows, and leave the columns with their headers?
Jul 26 '07 #2
rdubus
2
If you bind the datasource to null, it will clear EVERYTHING.

Are you wanting to remove all the rows, and leave the columns with their headers?
Yes, I want to remove all the rows, and leave the columns headers.
how do I do that?
Jul 26 '07 #3
Yes, I want to remove all the rows, and leave the columns headers.
how do I do that?
try

NameOfYourDataGrid.DataSource = Nothing
Jul 27 '07 #4
budong
2
Making the datasource into null or nothing doesnt clear your datagrid...to clear its content..you should clear your dt or datatable first
Nov 11 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: John Dann | last post by:
I need to display some internal program data in a grid to help with debugging (just display a simple 2D table, not edit or anything else), but I'm not an experienced database coder. AFAICS the only...
2
by: Chris Peeters | last post by:
Hi, I set up some columns in a DataGridView. I fill the DataGridView with some records by executing an sql-select statement .. so far so good Afterwards I clear the DataGridView using : ...
7
by: Mitchell S. Honnert | last post by:
Is there an equivalent of the DataGrid's DataGridTableStyle for the DataGridView? If not, is there an easy way to duplicate the DataGridTableStyle's functionality for the DataGridView? Here's...
11
by: Kevin | last post by:
I've been searching forever for examples of saving data changes in a DataGridView. There's all kinds of examples, but none really show how to save changes. Someone please help me. I have a...
7
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is...
4
by: =?Utf-8?B?UmljaA==?= | last post by:
On a form - I have a datagridview which is docked to the entire form. The datagridview allows users to Delete and/or Add Rows. On the Form_Load event I Fill the datagridview source table with a...
6
by: hzgt9b | last post by:
Using VS2005, VB.NET, I have a windows app with a DataGridView (lets call it DGV). At some point in the life of my app I want to clear the selection of the currently selected row...
0
by: Flupke | last post by:
Hello All, In a VB2005 Application, I want at a certain point clear the contents of a datagridview, but maintain the columnheaders on the datagrid itself so that it is obvious that the...
1
by: TG | last post by:
Hi! I have an application in which I have some checkboxes and depending which ones are checked those columns will show in the datagridview from sql server or no. After that I have 2 buttons:...
2
BRawn
by: BRawn | last post by:
Hi guys, I'm struggling to copy rows from one DataGridView to another. This may sound redundant but it's necessary for my Orders project. I have 3 DataGridViews on one form. The first...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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...

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.