I am trying to add a key event handler to a Datagridview.
I have added this (below) to my code:L
private void DgvDb_KeyUp(object sender, KeyEventArgs e)
{
colI = DgvDb.CurrentCell.ColumnIndex;
if (colI < 3 | colI == 12 | colI == 13 | colI == 15 | colI == 16 | colI == 17 | colI == 18 | colI == 19 | colI == 20 | colI == 21 | colI == 22)
{
vlue = Convert.ToString(DgvDb[colI, rowI - 1].Value);
DgvDb[colI, rowI].Value = vlue;
}
}
It shows "0 references" and in the code there is a redline under DgvDB saying it "does not exist in the current context". In the rest of the program, DgvDB is recognized.
I looked at similar code elsewhere in my application and looked at a reference in the XXX.Designer.cs.
I added to my designer under //DgvDB
this.DgvDB.KeyUp += new System.Windows.Forms.KeyEventHandler(this.DgvDB_KeyUp);
Here, DgvDB_KeyUp is redlined saying does not contain a definition for DgvDB_KeyUp.
