Home Forums WinForms controls Xceed Grid for WinForms Problem adding data to Grid/Datatable

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #13703 |

    I have what I am sure is a simple problem. I have a grid attached to a Datatable. When the user wishes to add a row I initialize it by using the grid_AddingDataRow event. I initialize the data by using a series of “e.DataRow.Cells[0].Value = 1;”. This is all fine except if the user is satisfied with the default data and does not change any of the values he hits return to exit the row and the row is not added and the “*” is shown next to the insertion row showing it is ready for use. How do I allow the user to hit “enter” accecpting the default values?

    Imported from legacy forums. Posted by Shofb (had 2562 views)

    User (Old forums)
    Member
    Post count: 23064

    Try this (untested code): <code>insertionRow.KeyDown += new KeyEventHandler(insertionRow_KeyDown);
    private void insertionRow_KeyDown(object sender, KeyEventArgs e) {
    if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return) {
    insertionRow.BeginEdit();
    insertionRow.EndEdit();
    }
    }</code>

    Imported from legacy forums. Posted by Tommy (had 207 views)

    User (Old forums)
    Member
    Post count: 23064

    Hey. thanks for the suggestion but… no go. This seems like something other people would have encountered before, maybe not.

    Imported from legacy forums. Posted by Shofb (had 3543 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.