Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

TextBox that accepts single character

$
0
0

I am trying to implement a control that accepts a single character from the user.  Currently I'm using a TextBox with MaxLength of 1.  I programaticaly initialize it with ',' (it's a separator character).

But when the user tries to change this value, he/she cannot simply type in a new value.  Neither the Del key or the Backspace key erases the current character.  The SelectAll() function (which I invoke on TextBox Entry) appears to do nothing.  The user has to select (with the mouse) the current character and only then can he type in a new value.

This is too much to expect from users.  They should simply be able to type in a new value.

The TextBox has all its default values.  It definitely is enabled and has focus (the flashing cursor appears).  It is not readonly.  I have set WordWrap to false (didn't work with WordWrap true either).

Is there some other control that I should be using besides TextBox?  I don't see any.

Thanks in advance,

Michael Bate


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>