|
-
May 27th, 2011, 11:01 AM
#1
Thread Starter
Addicted Member
[RESOLVED] datagridview values
I keep finding ways to clear all the rows of a datagridview... but i want to keep my rows...
is there an easier way than looping through every cell to clear all the values out of the cells of the datagridview??
-
May 27th, 2011, 11:16 AM
#2
Re: datagridview values
Is the DGV bound to a datasource, such as a table, or is it free-standing?
My usual boring signature: Nothing
 
-
May 27th, 2011, 11:31 AM
#3
Re: datagridview values
I do not think you can use a datagrid view with empty rows. You may need to create your own control for that. I may be wrong.
More important than the will to succeed, is the will to prepare for success.
Please rate the posts, your comments are the fuel to keep helping people
-
May 27th, 2011, 12:06 PM
#4
Re: datagridview values
You can do it, but it requires different things if the DGV is bound to a datatable or not. If it is not bound, then you will have to clear it manually. It's just a double loop, though. If the DGV is bound to a datatable, then you don't really want to clear the DGV. Instead, you want to clear the table fields, and that opens up a whole different set of considerations.
My usual boring signature: Nothing
 
-
May 27th, 2011, 12:20 PM
#5
Thread Starter
Addicted Member
Re: datagridview values
le sigh... ok its not bound to a datasource so i'll need to use the loop that i have.
bummer, seems like that is something there would be a 1 line command to execute
-
May 27th, 2011, 02:15 PM
#6
Re: [RESOLVED] datagridview values
It does seem that way, and if there is such a thing it would be something like Clear, but I doubt it even exists. MS really pushes the idea that a DGV is bound to something, and in most uses it is. They did add enough functionality so that the DGV is useable without being bound, but not an excess of functionality.
Had they supplied a Clear method, it would only have made sense for unbound DGVs, since Clear on a DGV that was bound to a datatable would be pretty much undefined. It wouldn't be able to clear the table, since that would rarely be acceptable, and it certainly couldn't delete all the rows, since that would likely be a disaster. Therefore, the Clear method would work only for a distinct minority of cases. You, unfortunately, are part of that minority.
My usual boring signature: Nothing
 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|