Henry Gathigira
Henry Gathigira

Reputation: 305

How to customize a textbox

I want to customize a textbox such that the user will input date as shown in image1 below. Note these points :

  1. Apr not 04 or April or anything else.
  2. The order must be dd/mmm/yyyy. even if their computer system date is set otherwise.
  3. Text to be aligned left. How do i do that textbox in visual basic 2010 ?

Image1

Upvotes: 0

Views: 227

Answers (1)

sujith karivelil
sujith karivelil

Reputation: 29006

I think a MaskedTextBox with a custom format will be the right option for you. So that you can restrict the user to enter digits for month and letters for day and year. you can set the mask like the following:

txtCustomDate.Mask = "00/LLL/0000"

Where 0 stands for integer L for Letter, required. Restricts input to the ASCII letters a-z and A-Z. This mask element is equivalent to [a-zA-Z] in regular expressions.

You may get better format options from here

Upvotes: 1

Related Questions