|
-
June 26th, 2009, 05:01 PM
#1
DataGriview issue PLease help!
I have a datagridview on a windows form and I need to select all the rows in the gridview when the user clicks a check box on the form.
I put the code in the the Form_Load event handler:
Code:
if (ckSelAll.Checked == true)
{
foreach (DataGridViewRow dgrv in MyGridView.Rows)
{
dgrv.Selected = true;
}
}
when I load the form and check the checkbox, nothing happens.
Please help. Thanks.
-
June 26th, 2009, 05:28 PM
#2
Re: DataGriview issue PLease help!
create a new button, add this code to the button, check a value and then click on the button then it will work.
it doesn't work right now because you have it on form load... but when the form loads no one of the values is checked.
-
June 28th, 2009, 09:40 AM
#3
Re: DataGriview issue PLease help!
I can't remember if there is a property for this, but make sure you can select multiple rows. The datagridview could be set so that only one row can be selected at a time.
-
June 28th, 2009, 02:08 PM
#4
Re: DataGriview issue PLease help!
Code:
if (ckSelAll.Checked == true)
{
foreach (DataGridViewRow dgrv in MyGridView.Rows)
{
dgrv.Selected = true;
}
}
You simple need to put this code into the buttons Click delegate
 Jonny Poet
To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
If anyone felt he has got help, show it in rating the post.
Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
My latest articles :
Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7
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
|