Answered Automatic textbox entries

  • jueves, 19 de abril de 2012 9:42
     
     

    So what I want to do is fairly simple, yet the knowledge eludes me.

    When a user is entering text into my textbox I'd like it to automatically present a '/' when the 3rd and 6th character is entered. An example would be like "dd/mm/yyyy".

    Another scenario also would be if they done "11/01/12", I would like the system to pick up the fact that year is only 2 characters long and not 4, so it automatically enters '20' at the start of yy.

    - Lastly, for some reason if I set the Text property of my textbox to 'dd/mm/yyyy' and build and debug my solution the text fails to appear in the textbox, why is that? I couldn't think of anything since it works fine in VS2012 C#. By the way I'm using Visual Basic on VS2005.

Todas las respuestas

  • jueves, 19 de abril de 2012 9:57
     
     Respondida
    Ignore the last part, I realised my mistake were I was setting the box to String.Empty, that part is fixed.
  • viernes, 20 de abril de 2012 5:08
    Moderador
     
     Respondida

    Hi FernieBhoy,

      I think you'd better using DateTimePicker control instead of the text within data input valiation. This is because that the data picked up  from DatetimePicker can easily convert into another type such as DataTime and so on.

      Hope it help you.

      Sincerely,

      Jason Wang


    Jason Wang [MSFT]
    MSDN Community Support | Feedback to us

  • miércoles, 02 de mayo de 2012 10:31
     
     
    Thanks, this worked a treat, looks better too. :)