views:

534

answers:

1

Hi all,

New to .NET/C# stuff so please forgive me if it's something obvious ;-) I'm trying to get cell editing going on a DataGridView control (WinForms). I've set all "ReadOnly"-type options to false, I've set EditMode to "EditOnEnter", I've added a row and selected a current cell programmatically, I've tried calling BeginEdit() but all to no avail - I can't edit the cell's contents.

The only thing that I can think of is that the control isn't bound to a data source - I'd like to be able to use it in a spreadsheet manner, so as the contents are typed in, I can then add new rows etc, and on a button click, the data can be retrieved programmatically for later use.

Is this possible?

Thanks,

Rich

A: 

I do that all the time (i.e. allowing users to edit a column without the DataGridView being bound).

Try this:

  1. Set EditMode to EditOnKeystrokeOrF2
  2. Ensure ReadOnly on the DataGridView is set to false
  3. Ensure that ReadOnly on the column you want to edit is set to false

That should work.

Michael Todd
Spot on - the column was ReadOnly! Cheers :-)
richsage