Event on DataTable cell

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a datGrid which related to a DataTable.
i want to create a KeyDown evet on one of my table's cell, this is what i did:

dgtbc = dgtsPay.GridColumnStyles[2] as DataGridTextBoxColumn;
if(dgtbc != null)
{
dgtbc.TextBox.KeyDown += new
System.Windows.Forms.KeyEventHandler(this.payed_cell_KeyUp);
dgtbc.TextBox.KeyUp += new
System.Windows.Forms.KeyEventHandler(this.payed_cell_KeyDown);
}

i created each event, but when i'm on that specific cell, nothing happens,
the event is not called.

this cell represents a date that the user enters, the format of the date is
dd\mm\yy
i want to enter the "\" automaticly each time it suppose to be.

thanks,
Gidi.
 
The event of the datagrid is processed by controls within the datagrid
(TextBox in this case), which means if ya want to be dealin with the keyup
and keydown event in another control, ya hav to wire the event to other
controls as well.
 
Back
Top