|
-
Oct 16th, 2006, 09:13 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] [2005] Check all checkboxes in datagridview
Hi guys,
I have a datagridview and i import a worlsheet from a selected spreadsheet. All the data is imported to the datagridview. I have created a separate column at runtime which has checkboxes so that the user can select which rows they want.
Now I was wondering whether it was possible to create a button that will check all the checkboxes in the datagridview if the user either wants all the rows selected or a vast majority of them (so they can unselect the ones they dont want)?
I've been searching for the past hour or so and cant find anythin to help me so can anybody out there offer me something that might work?
Thanks in advance
-
Oct 16th, 2006, 09:18 AM
#2
Re: [2005] Check all checkboxes in datagridview
The Value of a DataGridViewCheckBoxCell is a Boolean value, so True is checked and False is unchecked. You need to loop through the rows of the grid and set the Value of the appropriate cell to True or False. For instance, if the boolean column is at index 4:
VB Code:
For Each row As DataGridViewRow In myDataGridView.Rows
row.Cells(4).Value = True
Next row
-
Oct 16th, 2006, 09:23 AM
#3
Thread Starter
Fanatic Member
Re: [2005] Check all checkboxes in datagridview
Thanks works perfectly.
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
|