How to allow mutliple rows to be selected and edit individual cells in DataGridView

Posted on 2009-04-22
Medium Priority
Last Modified: 2013-11-07
I have a datagridview with specific cells that are editable.  I also want to allow the user to select multiple rows and click a button that will copy 1 value in the row to another on each row selected.  I tried changing dg.selectionMode = "FullRowSelect", but then I can't change the individual cells.

Or a different way to do this would be to get all of the fields associated with the row in which a cell was selected if only cells can be multi-selected.
Question by:djoyceRRD
  • 3
  • 2
LVL 83

Expert Comment

ID: 24213035
The description is not very clear. Please restate the problem.
LVL 96

Expert Comment

by:Bob Learned
ID: 24213194
I hear that the user will be able to select multiple rows, and there is a need to copy 1 value in the row, but it is unclear what the source row is.  It might be possible to achieve that effect with copying/pasting techniques, but without further explanation, it is difficult to tell for certain...

Author Comment

ID: 24214254
Sorry, let me try again.

I have a browse that is editable.  I also want to let the user select multiple rows and hit a button that will automatically copy a value in the row to another (this will happen row by row).  The user won't be doing the copy, the code behind the button will.

I was going to use dg.selectedRows to read through each one selected, but cannot figure out how to let the user select multiple rows while still having individual cells be editable.

I upped the points to 500 since this is a little more confusing.
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

LVL 83

Accepted Solution

CodeCruiser earned 2000 total points
ID: 24214280
The user can select multiple rows by clicking on the row header on the left most side.
LVL 83

Expert Comment

ID: 24214295
Its the place where you see the arrow when you click on a row in the grid. Use can either drag the mouse to select multiple rows or use the CTRL or SHIFT keys.

Author Comment

ID: 24214437
That plus dg.SelectionMode = RowHeaderSelect did it.


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

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deletiā€¦
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

809 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