472,983 Members | 2,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,983 software developers and data experts.

Clear data in DataGridView

Hello all
I've been trying to do a little project here and i am stuck at the
point where I can not clear the data out of datagridview table. I've done
lots of reading from different sources on internet. Most of the suggestion
is put this line of code in DataGridView1.Rows.Clear() < This line
never work and if give me and ArgumentException Error. Could any one please
help me out. I am using vb 2005. Thanks
HN

Aug 16 '07 #1
1 10812
Huy,

A datagridview is normally accessed by its underlying datatable. If you
clean that than it is empty. Or even more simple.

DataGridView1.datasource = nothing

Cor

"Huy Nguyen" <HN*****@gcprestress.localschreef in bericht
news:4D**********************************@microsof t.com...
Hello all
I've been trying to do a little project here and i am stuck at the
point where I can not clear the data out of datagridview table. I've done
lots of reading from different sources on internet. Most of the suggestion
is put this line of code in DataGridView1.Rows.Clear() < This line
never work and if give me and ArgumentException Error. Could any one
please help me out. I am using vb 2005. Thanks
HN
Aug 16 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Henry J. | last post by:
When the user loads the data into a DataGridView, some error icons may be shown to indicate some errors like when uniqueness is violated. The user can go ahead modifying the data rows. Once the...
2
by: Ivan | last post by:
I have a class Foo which have two property. I have a thread that do some process and update class Foo int B. I have a datagridview on main form. this datagridview data source to this class Foo and...
2
by: Rick Shaw | last post by:
Hi, I have a problem with the datagridview not refreshed when the application first appear on the screen. The datagridview display data from a table in the dataset. At the same time, I've added...
0
by: David Mayerovitch | last post by:
As an exercise in learning Visual Basic 2005, I am putting together a simple XML editor. I place on the form the objects DataGridView1 and DataSet1. ' Read an XML file into DataSet1:...
6
by: Bill Nguyen | last post by:
I tried almost everything ..Rows.clear() ..rowcount = 0 and the rows in a datagridview still not cleared I populated the Datagridview manually using Row.Add Any help is greatly appreciated ...
2
by: ysidro | last post by:
this is maby a answer and not a discussion. I saw many questions about how to clear an unbound datagrid in C#. Here is de ansuer: " dataGridView1.Rows.Clear(); "//clear or delete all columns in...
4
by: rdubus | last post by:
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...
2
by: cameljs18 | last post by:
I have a datatable into which i insert data then display the data in a datagridview.When i want to clear the table and place completely new data in the table, the table still retains the column...
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...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.