Hi
I am using ultraGrid (NetAdvantage 8.1 Win CLR2x). When user hits Enter Key on a row i have to show the details of the row on a different form.
KeyDown event is not getting fired when i hit enter on row. Can any one help me?
private void ultraGridCatalogVehicles_AfterRowActivate(object sender, EventArgs e) { ultraGridCatalogVehicles.KeyDown += new KeyEventHandler(ultraGridCatalogVehicles_KeyDown); }
void ultraGridCatalogVehicles_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (ultraGridCatalogVehicles.Rows.Count > 0) { int rowIndex = ultraGridCatalogVehicles.ActiveRow.Index; int catalogVehicleId = Convert.ToInt32(ultraGridCatalogVehicles.Rows[rowIndex].Cells["CatalogVehicleId"].Value); } } }
my form has a Accept button set. other than that no other control is using the enter key. But i found a work around for this my making use of the PreviewKeyDown. This works fine with that event.
Are you saying that the event fires for other keys and just not the enter key?
If that's the case, then my best guess is that it's because the grid is actually using the Enter key for something. Maybe because the enter key is mapped to some action in the KeyActionMappings.
Or perhaps some other control on the form is using the enter key. For example, do you have a toolbar on the form with a tool that is using Enter as a shortcut? If so, Enter will not fire events for any controls on the form.