Setting newly added row to current position when using bindingsource.addnew RRS feed

  • Question

  • I am using a bound datasource and I use the binding source to add a new row to the datatable.. What I want to be able to do is to set the newly added row to the current so that the use can begin editing it..

    In short, I have a list of order lines and the use right-clicks the mouse and selects "add new item" to it, I need to populate some default values(which I am doing) and then allow them to start filling in information on the datagridview for the newly added row.. Any help with this?

    Monday, April 25, 2011 7:28 PM


All replies

  • You can set selection to the particular cell of the dataGridViee, not to it`s row, and not to the dataTable.

    To set focus on the cell you can do:

     dataGridView1.CurrentCell = dataGridView[x, y];

    x and y are indexes for the column and row individualy.

    • Marked as answer by Neddy Ren Tuesday, May 3, 2011 2:34 AM
    Monday, April 25, 2011 7:40 PM
  • AddNew returns a DataRowView.. How do I translate the new DataRowView into a position on the DataGridView?
    Monday, April 25, 2011 7:50 PM
  • What?
    Monday, April 25, 2011 7:53 PM
  • I want programitcally add a new row, fill in some default values, then position to it, then have a certant column in that new row in edit mode all in one step..
    Monday, April 25, 2011 8:00 PM
    • Proposed as answer by Neddy Ren Friday, April 29, 2011 7:09 AM
    • Marked as answer by Neddy Ren Tuesday, May 3, 2011 2:35 AM
    Monday, April 25, 2011 8:25 PM