CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Error number 5

  1. #1
    Join Date
    Apr 2000
    Location
    Rio de Janeiro - Brazil
    Posts
    8

    Error number 5

    Do anybody knows why this generates a #5 error??
    Private Sub Form_Load()
    Me.Text1.SetFocus
    End Sub


    Julio Borges
    Rio de Janeiro - Brazil
    [email protected]

  2. #2
    Join Date
    Nov 2000
    Location
    Tokyo and Memphis
    Posts
    238

    Re: Error number 5

    Private Sub Form_Activate()
    Command1(1).SetFocus 'will work
    End Sub

    Private Sub Form_Load()
    Command1(1).SetFocus ' will not work
    End Sub

    I think setfocus is not the stuff of load events. Activate, which fires automatically after the laod event, does like setfocus though.

    Phil



  3. #3
    Join Date
    Mar 1999
    Location
    Nepal
    Posts
    540

    Re: Error number 5

    If you want it in the load event, then you must place a Me.Show before calling Text1.Setfocus.


  4. #4
    Join Date
    Apr 2000
    Location
    Rio de Janeiro - Brazil
    Posts
    8

    Resolved

    Thanks a lot. It worked fine.

    Julio Borges
    Rio de Janeiro - Brazil
    [email protected]

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