Click to See Complete Forum and Search --> : How to let user enter dd/mm/yyyy to dd/mm/yyyy


wky086
May 20th, 2001, 11:45 PM
Hi:
Here I have a imple question. I want to let user enter a period form to in the format of dd/mm/yyyy to dd/mm/yyy.If I want to let user enter in the .. area in the following
../../.... to ../../....
How can I do it.
I try to use text box, with / / to / / in the text field . It doesn't work.
I don't want to use DTpicker.
If anybody can help, It will be very great!!

wky086

cksiow
May 21st, 2001, 12:02 AM
try http://vblib.virtualave.net, there is a function call AllowsOnlyData in vbKeyboard which might help. put the function in the textbox keypress event.

HTH

wky086
May 21st, 2001, 02:05 AM
Hi:
Thanks for your reply, but I cannot find this function form that website.


wky086

cksiow
May 21st, 2001, 02:33 AM
download the DLL and register it. add a reference to the DLL and you will need to create an instance of vbKeyboard as below

dim vbKeyboard as new vbKeyboard

then you can call

vbKeyboard.AllowsOnlyDate

HTH

Iouri
May 21st, 2001, 07:05 AM
Do validation on LostFocus event. Something like

If left(txtMyDate,3) <> "/" then msgbox "Invalid Format"
If mid(txtMyDate,6,1) <> "/" then msgbox "Invalid Format"
etc


Iouri Boutchkine
iouri@hotsheet.com

coolbiz
May 21st, 2001, 08:03 AM
Use Microsoft Masked Edit Control 6.0 and set the .Masked property to ##/##/####

-Cool Bizs