Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Datagrid - Deselect selected rows

Posted on 2006-07-06
8
Medium Priority
?
3,356 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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 800 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

715 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