VS 2010 A date only texbox-VBForums
Results 1 to 5 of 5

Thread: A date only texbox

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2012
    Location
    Los Angeles, CA
    Posts
    46

    A date only texbox

    How do I make a textbox control to accept dates only and convert to a valid date format? I don't want to use the calander control.
    e.g.
    if I enter 2/17 or 2-17 or 02/17 or 2/17/2012; it will convert to
    2/17/2012

    thank you

  2. #2
    Hyperactive Member
    Join Date
    Jun 2009
    Posts
    307

    Re: A date only texbox

    If you use the Short format for the DateTimePicker control it will only show the date, not the full calendar. Also set ShowUpDown = True to use up/down arrows instead of the calendar.
    Last edited by dkahn; Feb 3rd, 2012 at 12:11 PM.

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2012
    Location
    Los Angeles, CA
    Posts
    46

    Re: A date only texbox

    I do not want to use date/time control at all. I want to have a text box and have flexibility to enter dates in many different ways.
    2/17 or 2-17 or 02/17 or 2/17/2012; it will convert to
    2/17/2012

  4. #4

    Thread Starter
    Member
    Join Date
    Jan 2012
    Location
    Los Angeles, CA
    Posts
    46

    Re: A date only texbox

    I need help, please!

  5. #5
    PowerPoster kevininstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    5,696

    Re: A date only texbox

    Quote Originally Posted by mquamar View Post
    I do not want to use date/time control at all. I want to have a text box and have flexibility to enter dates in many different ways.
    2/17 or 2-17 or 02/17 or 2/17/2012; it will convert to
    2/17/2012
    Here are some resources to work thru your problem. Consider creating a class which uses IExtenderProvider Interface (see link below)

    References
    Standard Date and Time Format Strings
    Custom Date and Time Format Strings

    IExtenderProvider Interface

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.