DataGridTextBoxColumn TextChanged Event

  • Thread starter Thread starter Wild Gooose
  • Start date Start date
W

Wild Gooose

Here is a scenario.
I want to prevent the user from typing non-numeric char's
in a DataGridTextBoxColumn. So, I am capturing the
TextChanged event of the DGTBcolumn.
2 strange things are happening.
a. The event is called when the focus in place on the
cell. I don't understand why
b. When I start typing the first character, the event gets
fired twice. In the first call, the text property of the
textbox is empty, but in the second call I can see the
char I typed.

Can anyone please help me with this. Do I need to capture
any other event, or is there a better way to handle
textchanged event.

Any help appreciated.

Thanks
 
Ken - Thanks for the response.

I did try the KeyPress event. The event seem to be
capturing the pervious char. What I mean is, on the first
keypress event, the text in the event handler is the
default text in the text box. On the second keypress
event, the text in the event handler is the first char I
typed. On the third keypress event, the text in the event
handler is the first and the second char. It seems to be
skipping the current char in the text box.

I have not implemented my own DataGridTextBoxColumn, and I
am not sure if this could be the problem.
 
hi,

maybe u should use the KeyUp event, because when it´s fired, the
Char must be written into the TextBox

peace René
 
Back
Top