CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    May 2000
    Location
    Hong Kong
    Posts
    94

    How to let user enter dd/mm/yyyy to dd/mm/yyyy

    Hi:
    Here I have a imple question. I want to let user enter a period form to in the format of dd/mm/yyyy to dd/mm/yyy.If I want to let user enter in the .. area in the following
    ../../.... to ../../....
    How can I do it.
    I try to use text box, with / / to / / in the text field . It doesn't work.
    I don't want to use DTpicker.
    If anybody can help, It will be very great!!

    wky086

  2. #2
    Join Date
    Apr 2000
    Posts
    737

    Re: How to let user enter dd/mm/yyyy to dd/mm/yyyy

    try http://vblib.virtualave.net, there is a function call AllowsOnlyData in vbKeyboard which might help. put the function in the textbox keypress event.

    HTH


  3. #3
    Join Date
    May 2000
    Location
    Hong Kong
    Posts
    94

    Re: How to let user enter dd/mm/yyyy to dd/mm/yyyy

    Hi:
    Thanks for your reply, but I cannot find this function form that website.


    wky086

  4. #4
    Join Date
    Apr 2000
    Posts
    737

    Re: How to let user enter dd/mm/yyyy to dd/mm/yyyy

    download the DLL and register it. add a reference to the DLL and you will need to create an instance of vbKeyboard as below

    dim vbKeyboard as new vbKeyboard

    then you can call

    vbKeyboard.AllowsOnlyDate

    HTH


  5. #5
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: How to let user enter dd/mm/yyyy to dd/mm/yyyy

    Do validation on LostFocus event. Something like

    If left(txtMyDate,3) <> "/" then msgbox "Invalid Format"
    If mid(txtMyDate,6,1) <> "/" then msgbox "Invalid Format"
    etc


    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  6. #6
    Join Date
    Feb 2001
    Location
    Stamford CT USA
    Posts
    2,167

    Re: How to let user enter dd/mm/yyyy to dd/mm/yyyy

    Use Microsoft Masked Edit Control 6.0 and set the .Masked property to ##/##/####

    -Cool Bizs

    Good Luck,
    -Cool Bizs

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