Results 1 to 4 of 4

Thread: Need Help : Textbox date format

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2013
    Posts
    328

    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

  2. #2
    Fanatic Member
    Join Date
    Jul 2006
    Location
    nasik,india
    Posts
    909

    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

  3. #3
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    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)

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    May 2013
    Posts
    328

    Re: Need Help : Textbox date format

    Quote Originally Posted by shukla View Post
    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
  •  



Click Here to Expand Forum to Full Width