Results 1 to 4 of 4

Thread: text box won't take focus [RESOLVED]

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489

    text box won't take focus [RESOLVED]

    In my form load event I have this code:

    VB Code:
    1. textbox.focus()

    and, i have another event, tab_selectedIndexChanged, that does the same.

    when my app first fires up, the text box doesn't get the focus as expected but works fine if the tab pages are clicked back and forth.

    what could be wrong here?
    Last edited by Andy; Apr 19th, 2004 at 08:56 AM.

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    I'd bet that the form isn't shown yet when you are calling it (which is the case on form_load) so you can't actually set focus on it. An alternative is use the Actiave event (or what ever the .NET equivelent is)

    TG
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489

    Thumbs up

    that took care of it!! thanks a bunch!!!!!!!!!!

  4. #4
    Junior Member
    Join Date
    Feb 2004
    Location
    Cape Town, South Africa
    Posts
    18
    This only happens in VS.net 2002, it is fixed in vs.net 2003.

    Took me a few days to discover !!

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