Masked textbox alignment?

  • Thread starter Thread starter Brett Romero
  • Start date Start date
B

Brett Romero

I have a masked textbox that excepts values of 0 thru 99. The mask is
00. Tabbing into this box is fine but if you click into it, you are one
space over from the left. This means you can only type one number. So
you have to hit <backspace>. How do I make it so clicking into this
box puts your cursor all the way to the left side?

Also, I can't get the box to accept the range "-1" thru "99". How can
that be done?

..NET 2.0 of course.

Thanks,
Brett
 
I have a masked textbox that excepts values of 0 thru 99. The mask is
00. Tabbing into this box is fine but if you click into it, you are one
space over from the left. This means you can only type one number. So
you have to hit <backspace>. How do I make it so clicking into this
box puts your cursor all the way to the left side?

Also, I can't get the box to accept the range "-1" thru "99". How can
that be done?

.NET 2.0 of course.

Thanks,
Brett

Hi Brett,

Just a wild guess; but don't numeric fields feed from the right and fill to
the left. Maybe your width is too small for two characters? The Source code
would help.

Regards
Mark
 
Not sure which source code you are referring to. Drop the control onto
the form and there it is. Here's the wincode:

this.txtCount.Location = new System.Drawing.Point(519, 97);
this.txtCount.Mask = "00";
this.txtCount.Name = "txtCount";
this.txtCount.PromptChar = ' ';
this.txtCount.Size = new System.Drawing.Size(40, 20);
this.txtCount.TabIndex = 15;
 
Back
Top