I have a datagridview which updates the database on CellEndEdit method. On the stock code columns' cells when the user presses F10 a new list opens and the user can choose a new code. The value of my datagridview cell updates but CellEndEdit does not trigger. I have previously tried handling CellEndEdit whenever the user presses F10 on those cells but it fails(I believe my arguments etc are terribly wrong). I have looked at programmatically handling the event but it did not work. I was wondering how I can trigger CellEndEdit inside KeyDown Method.
private void dataGridView2_KeyDown_1(object sender, KeyEventArgs e)
{//F10 A BASILDIĞINDA EGER STOK KODU HUCRELERİNDEN BASILDIYSA STOK KODLARI AÇILIYOR
if (e.KeyCode == Keys.F10)
{
int satir = dataGridView2.CurrentCell.RowIndex;
int sutun = dataGridView2.CurrentCell.ColumnIndex;
if (sutun == 7)
{
// dataGridView2[e.ColumnIndex, e.RowIndex] = STOKKODU0COMBOBOX;
using (StokKoduListeForm stokkodulisteform = new StokKoduListeForm(secilenveritabani))
{
stokkodulisteform.ShowDialog();
dataGridView2[sutun, satir].Value = (stokkodulisteform.stokkodugetir());
}
}}
I have tried
DataGridViewCellEventArgs a = new DataGridViewCellEventArgs(sutun, satir);
dataGridView2_CellEndEdit_1(dataGridView2, a);
Inside the using but it shows a messagebox from another form somehow.