Link to home
Start Free TrialLog in
Avatar of djoyceRRD
djoyceRRDFlag for United States of America

asked on

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

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.
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

The description is not very clear. Please restate the problem.
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...
Avatar of djoyceRRD

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
That plus dg.SelectionMode = RowHeaderSelect did it.

Thanks!