Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

DataGridView Multi Row Select with Mouse click

Posted on 2008-06-23
5
Medium Priority
?
4,382 Views
Last Modified: 2013-12-16
I want to be able to select/deselect multiple rows in a databound DataGridView with a mouse click without having to use the Control key.  I thus have to disable the deselect row event when I click on a new row.  Also I want to be able to deselect already selected rows also with a mouse click.

If possible I want to do this without overriding the existing mouse click events in the DataGridView class.
0
Comment
Question by:pvrooyen
[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
  • 2
  • 2
5 Comments
 
LVL 12

Expert Comment

by:topdog770
ID: 21846294
With all respect, the three things you have listed seem to be... odd and perhaps a bit contradictory sounding as I was reading them.

What is your motivation for wanting to ignore the built in data grid view events?

You want to select multiple rows using just a mouseclick, but then want to deselect multiple rows with just a mouse click and don't want to use the datagridview mouse events.

Regarding the mouse click events, if there really is an excellent reason for not using the datagridviews mouse events, you could handle the mouse events at the parent control level using WndProc.

I suppose you could also set up the selection process to start by 'auto selecting' rows when the mouse is clicked while over a row, and use a timer that says if it's been more then a second since the user selected a row, change to deselect mode.

0
 
LVL 3

Expert Comment

by:pragmatistMS
ID: 21848131
I would agree with above poster.  Ctrl-Click for multiple select is a standard UI convention, my recommendation would be to not circumvent these conventions.  Sometimes users ask for bizarre things they believe will make their job easier, when in reality the confusion it creates makes their lives more difficult.
0
 

Author Comment

by:pvrooyen
ID: 21853429
I do not agree.  The user needs to make heavy intensive and repetitive use of selecting and deselecting rows constantly on a daily basis.  To implement that selecting/deselecting functionality without the use of a Control pressed key all the time have huge advantages in the long run.

>>You want to select multiple rows using just a mouseclick, but then want to deselect multiple rows >>with just a mouse click and don't want to use the datagridview mouse events.

Yes exactly, why does this request seem so strange?  I want a Control key depressed select/deselect functionality without pressing the Control key.

>>I suppose you could also set up the selection process to start by 'auto selecting' rows when the >>mouse is clicked while over a row, and use a timer that says if it's been more then a second since >>the user selected a row, change to deselect mode.

I would rather: OnMouseDownEvent: Select row if deselected OR Deselect row if selected.

Thanks.
0
 
LVL 3

Accepted Solution

by:
pragmatistMS earned 1500 total points
ID: 21855204
I do understand sometimes the need for specialized UI features at times.  What you want to accomplish is typically done with check boxes to the left of the row or some other convention, which would be my next suggestion.  Otherwise I will just bow out of the thread now so that others can respond.
0
 

Author Closing Comment

by:pvrooyen
ID: 31469673
Although there is a good reason for me to use full highligted rows as selected indicators I have awarded the points because at least you were offering an alternative.  It thus seems there are no easy way to do this.
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
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…
Loops Section Overview

597 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