MaskEdBox
-
previously, when generating reports, I entered a range of dates by means 2 textboxes. However, for the purposes of validation, i found this an inadequate way (eg it allows entry of days > 31 etc). instead i have started to use an MaskEdBox, i have set the DataFormat to Date, how do i set the format to ##/##/####? does it have similiar properties to that of the textbox? (ie MaskEdBox.Text etc)any help would be greatly appreciated, i am a newbie to this control!Thank you!
-
previously, when generating reports, I entered a range of dates by means 2 textboxes. However, for the purposes of validation, i found this an inadequate way (eg it allows entry of days > 31 etc). instead i have started to use an MaskEdBox, i have set the DataFormat to Date, how do i set the format to ##/##/####? does it have similiar properties to that of the textbox? (ie MaskEdBox.Text etc)any help would be greatly appreciated, i am a newbie to this control!Thank you!
mcm wrote: how do i set the format to ##/##/####? MaskEdBox1.Mask = "##/##/####" You will need to check the values to make sure that the user entered the correct values, I would suggest you write a function:
Private Sub MaskEdBox1_KeyPress(KeyAscii As Integer)
'Do your stuff here...
End Sub
Nick Parker
The only man who never makes a mistake is the man who never does anything. - Theodore Roosevelt
-
previously, when generating reports, I entered a range of dates by means 2 textboxes. However, for the purposes of validation, i found this an inadequate way (eg it allows entry of days > 31 etc). instead i have started to use an MaskEdBox, i have set the DataFormat to Date, how do i set the format to ##/##/####? does it have similiar properties to that of the textbox? (ie MaskEdBox.Text etc)any help would be greatly appreciated, i am a newbie to this control!Thank you!
Why dont' you try a DTPicker control - resembles a Combo, but when you hit the drop-down, it shows a Month in a calendar control. Still possible to directly enter a date, but won't let you enter an invalid one. To use, right click your toolbox and select components. Scroll down the resulting list, and select "Microsoft Windows Common Controls 2 6.0 SP4", or browse to MSCOMCTL2.ocx. This will add the control to your toolbox, and can be used in the normal way. Help for the control is in MSDN under VBReference->Controls Reference->ActiveX COntrols (Apologies if the preceeding is teaching my granny to suck eggs!)