Hi Folks,

I have a textbox which looks out for keypresses when it is in focus.
For example, when the ";" key is pressed, a few functions are called. THe problem is, is that in the KeyPress function for the textbox, i have textbox1.Text = ""; to clear it however it doesn't work.

It's as if the text box executes the KeyPress function (hence my clear statement) prior to actually outputting the ";" in the box.

So in the end, ";" gets displayed (However if I keep pressing ";", I only ever see one)

Any ideas on how I can fix this? Thanks

Simple... Just set e.Handled to true
When e.Handled is set to true, then the keypress event stops there, otherwise it is passed up the chain to the TextBox.
// Jerry