Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. (VB6.0)validating a textbox for MM/dd/yyyy format

(VB6.0)validating a textbox for MM/dd/yyyy format

Scheduled Pinned Locked Moved Visual Basic
helptutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    venkata lakshmi prasanna
    wrote on last edited by
    #1

    iam validating the textbox in lostfocus event but it is changing values for month to date and viceversa when the day is single digit. this is the code iam using,please mail how to weite code for validating.thanks Private Sub txtfromip_LostFocus() If txtfromip.Text <> "" Then On Error GoTo errtrap If Not IsDate(Format(txtfromip.Text, "MM/dd/yyyy")) Then MsgBox "Invalid Date. Enter Valid Date. Format is 'MM/dd/yyyy'", vbInformation txtfromip.SetFocus SendKeys "{home}+{end}" Else txtfromip.Text = Format(txtfromip.Text, "MM/dd/yyyy") End If Exit Sub errtrap: MsgBox Err.Description, vbCritical, "Error No:" & CStr(Err.Number) Err.clear End If End Sub

    B 1 Reply Last reply
    0
    • V venkata lakshmi prasanna

      iam validating the textbox in lostfocus event but it is changing values for month to date and viceversa when the day is single digit. this is the code iam using,please mail how to weite code for validating.thanks Private Sub txtfromip_LostFocus() If txtfromip.Text <> "" Then On Error GoTo errtrap If Not IsDate(Format(txtfromip.Text, "MM/dd/yyyy")) Then MsgBox "Invalid Date. Enter Valid Date. Format is 'MM/dd/yyyy'", vbInformation txtfromip.SetFocus SendKeys "{home}+{end}" Else txtfromip.Text = Format(txtfromip.Text, "MM/dd/yyyy") End If Exit Sub errtrap: MsgBox Err.Description, vbCritical, "Error No:" & CStr(Err.Number) Err.clear End If End Sub

      B Offline
      B Offline
      Burnsys2
      wrote on last edited by
      #2

      You should not use "SendKeys "{home}+{end}" If you want to select the textbox content try this: Text1.SelStart = 0 Text1.SelLength = Len(Text1.Text)

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups