Results 1 to 3 of 3

Thread: yet another setfocus question

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2002
    Posts
    70

    yet another setfocus question

    I am getting frusterated with this....

    I have a simple form and on the form there is a textbox called
    txtDetailerEnteredMileage

    I am trying to set focus to this on form load. Simply so the user does not have to move the cursor over and click in the box.

    However, when i try txtDetailerEnteredMileage.SetFocus
    I am getting Invalid Procedure Call or argument.

    I looked in the archives and from that made sure to verify that the textbox was visible and enabled. Any ideas? Any help would be immensely appreciated. Thanks

    Nightfox02

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    Unless you put a me.Show someplace in the Load event, the controls do not become visible until the Load is done so you can't set focus to them. The easiest thing to do is to set the focus in the Activate event instead of the Load event.

  3. #3
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    When a form is first loaded VB will set focus to the control whose TabIndex property is 0. No need to call the SetFocus method.

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