SSSoftware
asked on
Datagrid - Deselect selected rows
I have a datagrid that allows the user to select multiple rows.
The datasource for the grid is a table.
I would like to Deselect the selected row(s) when the user clicks on a command key.
Just as if he clicked on another row.
Help would be very much appreciated.
Thanks,
Ed
The datasource for the grid is a table.
I would like to Deselect the selected row(s) when the user clicks on a command key.
Just as if he clicked on another row.
Help would be very much appreciated.
Thanks,
Ed
http://www.developerfusion.co.uk/show/4632/3/
Hi, Is it a datagrid or a datagridview?
If DataGridView:
For each objRow as DataGridViewRow in dataGridView1.SelectedRows
objRow.Selected = False
Next
Cheers
Nick
If DataGridView:
For each objRow as DataGridViewRow in dataGridView1.SelectedRows
objRow.Selected = False
Next
Cheers
Nick
ASKER
Nick,
Thanks for bring up the DataGridView.
I have been working in a vacuum for the last year.
I'll look into using it. It could solve many of my other (not-So-Nice) problems that I'm having with the standard datagrid.
I'm having problems finding the DOWNLOAD site for the DataGridView Control. If you have it could you point me to it.
Ed
Thanks for bring up the DataGridView.
I have been working in a vacuum for the last year.
I'll look into using it. It could solve many of my other (not-So-Nice) problems that I'm having with the standard datagrid.
I'm having problems finding the DOWNLOAD site for the DataGridView Control. If you have it could you point me to it.
Ed
Hi,
The datagridview is part of the .NET 2.0 framework, which probably would have been the better question for me to have asked you (which framework are you building on?). I'm guessing that since you do not have it in your toolbox you are probably building on .NET 1.1, therefore my solution won't be any help to you sorry :-(
Do you bind to a datasource for the grid? If so this might work for the .NET 1.1 version (this is just free hand) :
' You might need a different syntax for getting the count, depending on your datasource
For i As Integer = 0 To DataGrid1.DataSource.Count - 1
DataGrid1.UnSelect(i)
Next
Hope this helps
Cheers
Nick
The datagridview is part of the .NET 2.0 framework, which probably would have been the better question for me to have asked you (which framework are you building on?). I'm guessing that since you do not have it in your toolbox you are probably building on .NET 1.1, therefore my solution won't be any help to you sorry :-(
Do you bind to a datasource for the grid? If so this might work for the .NET 1.1 version (this is just free hand) :
' You might need a different syntax for getting the count, depending on your datasource
For i As Integer = 0 To DataGrid1.DataSource.Count
DataGrid1.UnSelect(i)
Next
Hope this helps
Cheers
Nick
ASKER
Nick,
So far no good, There is not an UNSELECT method (or anything like it) available.
We will go to 2.0 as soon as most of our development is complete. We just don't want to change in the middle of development and we have 4 other products that should be upgraded at the same time.
Ed
So far no good, There is not an UNSELECT method (or anything like it) available.
We will go to 2.0 as soon as most of our development is complete. We just don't want to change in the middle of development and we have 4 other products that should be upgraded at the same time.
Ed
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Nick,
Thank You....
It works great.
I have completly missed unselect when I was searching.
I appreciate your help.
Ed
Thank You....
It works great.
I have completly missed unselect when I was searching.
I appreciate your help.
Ed