Solved

DataGridView Multi Row Select with Mouse click

Posted on 2008-06-23
5
4,319 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 500 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

Independent Software Vendors: 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!

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

690 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