CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 1999
    Posts
    8

    Setting focus back on a field

    In my UserForm the date input is made of 3 fields (TextBox): one for the day (MaxLength-Property=2), one for the month (MaxLength=2) and one for the year (MaxLength=4). When entering the fourth digit in the year field an Exit-Event is started which composes the date with the entered day's and month's digits. A date validation is then executed (in then Exit-Event/Function) and i would like the focus to be set back in then day-field if the composed date is not valid (with the setfocus-Method use in the year-field Exit-Event). But I can't!
    The focus doesn't stay in the day-field, it leaves it and jumps forward two field afer the year-field.


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

    Re: Setting focus back on a field

    if you use vb6 I suggest that you use the Validate Event. It's (almost) perfect for validating input and forcing the focus within a field.


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