The latter is easily solved by changing the StandardTab property to True.
Then I derived a class from DataGridView and overrode the ProcessDialogKey
and ProcessDataGridViewKey methods. Then I handle the Enter key behavior.
But of course I can't just tell it to behave like the Tab key, because now
the Tab key works differently because of the StandardTab setting. I tried
this, but it doesn't work. Any other ideas?
protected override bool ProcessDialogKey( Keys keyData )
{
if ( keyData == Keys.Enter )
{
StandardTab = false;
bool retCode = base.ProcessTabKey(Keys.Tab);
StandardTab = true;
return retCode;
}
return base.ProcessDialogKey(keyData);
}
Have a look at the DataGridView class in Reflector. You'll see that the
ProcessTabKey() method calls the private methods TabToNextCell() or
TabToPreviousCell(), depending on which modifier keys are pressed.
You'll probably want your own implementation of TabToNextCell() and
TabToPreviousCell(), using the existing code in DataGridView as a
starting point for your implementation.
--
Eddie ed...@deguello.org
OK thanks.