CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Date Validation

  1. #1
    Guest

    Date Validation

    Hi ,
    How do i check to see if the date entered in the textbox is in the correct format that i want it ot be.
    Eg: If i want the date to be in dd/mm/yyyy format then what do i have to do to check that this is the format that is correct.
    Can i write this in my code:--

    If IsDate(txtStartDT.Text) Then
    If txtStartDT.Text = mm / dd / yy Or txtStartDT.Text = yy / mm / dd Then
    MsgBox "Please enter dd/mm/yyyy format for STARTDATE only."
    txtStartDT.SetFocus

    Exit Sub

    End If

    End If

    I am working on a visual basic project and would like to know how to do this. i have an access database.
    This is not html vbscript!

    Also how do i stop someone from updating a certain textbox.
    Like if i dont want a user to update the textbox having the employee's name. What will be the form validation!!!!!
    Thanks for any answers,
    New to Visual Basic ............



  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: Date Validation

    >Also how do i stop someone from updating a certain textbox.

    set the Locked property to True to protect the field from data entry.

    Your date format problem:
    when outputting date values I'd use the Format statement.
    When interpreting date values assume that date values are in the format given in control panel - language settings.



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

Featured