Imitate DataGridViewTextBox behaviour to add rows

I'm currently developing custom datagridviewcells and facing the following problem:

When entering the last row in a databound datagridview (the "new row") and focusing a DataGridViewTextBoxCell the editmode is initialized and the grid waits for input.

After typing the first char, a new row is created and the row is bound to that row.

I need to imitate this behaviour WITHOUT typing.

I developed a custom datagridviewcell with its own datagridvieweditingcontrol but which method / property is responsible for adding the new row

I tried to call

Me.DataGridView.NotifyCurrentCellDirty(True)

but it doesn't work for me.

Any ideas Thanks a lot!



Answer this question

Imitate DataGridViewTextBox behaviour to add rows

  • Dave Hertel

    You'll need to use SendKeys for this as the DataGridView doesn't have any method exposed for doing this.

    -mark
    DataGridView Program Manager
    Microsoft
    This post is provided "as-is"


  • orcmid

    I tried to call SendKeys without success. Could you please give me a small example where to call it

    Thanks a lot!


  • Imitate DataGridViewTextBox behaviour to add rows