vb.net access input mask

menachem680
menachem680 used Ask the Experts™
on
i have a database access + a vb.net form for the user by acess i have a input mask like this
00:00  1/12/1987 i need the same by vb,form on a textbox how can i make this it shulde by on the textbox???
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2010
Commented:
Use MaskedTextBox control. Set its Mask property to ##:## ##/##/####.

Author

Commented:
wheree do i write this?
Éric MoreauSenior .Net Consultant
Top Expert 2016

Commented:
I would use a DateTimePicker control. check http://msdn.microsoft.com/en-us/library/4xyy1csh.aspx
OWASP: Avoiding Hacker Tricks

Learn to build secure applications from the mindset of the hacker and avoid being exploited.

Author

Commented:
thanks but the user want to put a time not the time from now he want to put any time he want how do he make a input mask?
Top Expert 2010

Commented:
As mentioned above, there are 2 ways to do it: MaskedTextBox or DateTimePicker.

1. To implement MaskedTextBox, in design time, double click on MaskedTextBox in the Toolbox (See screen shot 1). Then change its Mask property to ##:## ##/##/#### (see screen shot 2).

2. To implement DataTimePicker, in design time, double click on DataTimePicker in to toolbox (see screen shot 3). Then change its Format property to Custom and set its CustomFormat property to HH:mm MM/dd/yyyy (see screen shot 4).

Hope it helps.

MaskedTextBox.PNG
Mask.PNG
DateTimePicker.PNG
Format.PNG

Author

Commented:
so how  does one (datepiker)get to  my textbox with this ?
Éric MoreauSenior .Net Consultant
Top Expert 2016

Commented:
you get rid of your textbox, you replace it with the datetimepicker control
Top Expert 2010

Commented:
Just use ONE of them.
If using MaskedTextBox, do not use DateTimePicker. To get value from MaskedTextBox, use MaskedTextBox1.Text.

If using DateTimePicker, do not use MaskedTextBox. To get value from DateTimePicker, use DateTimePicker1.Value.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial