siwydym67 siwydym67 - 1 year ago 57
C# Question

Replace pressed key in TextBox to another C#

How can I replace pressed 'decimal point' key from numpad to always return '.' independent of regional setting. I want that works only for one (specific) TextBox not all in application.

It's possible to accomplished this without creating own control?

Answer Source

In order to do this, you simply need to handle the KeyDown event, supress the activated key if its the numpad decimal, and then simply send the new key you want.

It's pretty straightforward, the following links should give you enough pointers to actually write some code:

Once you've written something, you can ask a new question about any specific dificulties you might encounter.