Pages

Thursday, September 1, 2011

DataGridView: Edit Row on F2

The Problem: The DataGridView control defaults to EditMode=EditOnKeystrokeOrF2. That means that if you're tabbing around and you accidentally hit ANY KEY, you're going to munge your data.

One Solution: There is an EditMode setting called "EditOnF2" which requires the user to hit F2 before editing. It's a lot like locking all edits in your Excel spreadsheets. The user is now required to hit F2 to initiate editing on every cell.

This is annoying. Most all database programs go into edit mode on a per row basis, meaning if you want to edit row 456, you go into edit mode for the entire row, saving changes when you click 'save' or leave the row.


Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

No comments:

Share This!

Contact Us

Name

Email *

Message *