Solved

Datagrid - Deselect selected rows

Posted on 2006-07-06
8
3,328 Views
Last Modified: 2008-01-09
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
0
Comment
Question by:SSSoftware
  • 3
  • 3
  • 2
8 Comments
 
LVL 7

Expert Comment

by:rohanbairat3
ID: 17053969
0
 
LVL 7

Expert Comment

by:rohanbairat3
ID: 17053982
0
 
LVL 5

Expert Comment

by:nickhoggard
ID: 17056305
Hi, Is it a datagrid or a datagridview?

If DataGridView:

For each objRow as DataGridViewRow in dataGridView1.SelectedRows
    objRow.Selected = False
Next

Cheers

Nick
0
 
LVL 4

Author Comment

by:SSSoftware
ID: 17058875
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
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 5

Expert Comment

by:nickhoggard
ID: 17062264
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
0
 
LVL 4

Author Comment

by:SSSoftware
ID: 17080967
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
0
 
LVL 5

Accepted Solution

by:
nickhoggard earned 200 total points
ID: 17084555
Hi Ed,

I only wrote that example from what I saw in the MSDN library, since I dont have .NET 1.1 installed any more.

The page I was referencing is below, and it does seem to indicate that unselect is an option:
http://msdn2.microsoft.com/en-us/library/system.windows.forms.datagrid.unselect.aspx

Beyond that, I'm sorry I probably can't be of much more help without having the specific framework installed here.

Nick
0
 
LVL 4

Author Comment

by:SSSoftware
ID: 17114713
Nick,

Thank You....
It works great.
I have completly missed unselect when I was searching.

I appreciate your help.

Ed
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Tabcontrol Caption? 1 29
How can one ComboBox's items be determined by another? 9 28
Visual Studio editor? 1 38
I need help making a collection from a class in VB.Net 3 25
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now