-
Feb 1st, 2015, 11:19 PM
#1
Thread Starter
Hyperactive Member
Need Help : Textbox date format
Example :
1. 01/
2. 01/01/
3. 01/01/2015
As I type I need to have a slash char on count of 2 and 5 which is already done.
Now, my problem is when I press backspace I was stuck on this "01/01/", its not continuing until textbox is blank.
Code:
Private Sub Text1_Change()
If Len(Text1.Text) = 2 Or Len(Text1.Text) = 5 Then
Text1.Text = Text1.Text + "/"
End If
Text1.SelStart = Len(Text1.Text)
End Sub
Any help
-
Feb 2nd, 2015, 01:05 AM
#2
Fanatic Member
Re: Need Help : Textbox date format
Hello,
User MaskEdbox control for this.
WHETHER YOU SUCCEED OR FAIL IS NOT AS IMPORTANT AS WHETHER YOU TRIED YOUR BEST
-
Feb 2nd, 2015, 01:49 AM
#3
Re: Need Help : Textbox date format
Yeah, use the right control for the job. You might also want to consider the DateTimePicker control.
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
Feb 2nd, 2015, 05:09 AM
#4
Thread Starter
Hyperactive Member
Re: Need Help : Textbox date format
Originally Posted by shukla
Hello,
User MaskEdbox control for this.
Is it possible on Lost Focus if no value, clear format or simply blank?
Example : Mask Format "##/##/####"
With Value : "01/01/2015"
Without Value : "//"
How do I remove this "//" if no date found?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|