How do I trap and/or replace the Enter key within the DataGridView

B

B. Chernick

How do I trap and/or replace the Enter key within the DataGridView while in
an editing field?

I have a bound grid with add enabled (VB/Dot Net 2.0). When I'm in the Add
Line (if that's the correct term) the first cell is temporarily set to
ReadOnly=False so the user can enter a search key. The user then Tabs to the
2nd cell in which a lookup within the CellEnter event takes the key and does
a search, sometimes generating a popup. Once a value is selected from the
popup, the record is completed and added to the grid. TABs work fine but an
Enter always cancels the Add and sends the cursor back to the last record of
the grid.

If this sounds like improvisation, it is. I've created this through trial
and error. This is supposed to be a simple data entry/editing program for
people accustomed to Excel. So far I have been unable to find a scenario
close to this in any on-line sample. (I need to be able to intuitively
add/edit/delete within the grid, without resorting to external buttons for
anything other than the final mass update to the database.)
 
B

B. Chernick

May as well forget this one as well. I've disabled Add and used a popup
dialog instead. The key events were just too much trouble.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top