Results 1 to 4 of 4

Thread: [RESOLVED] Runtime error 5

  1. #1

    Thread Starter
    Hyperactive Member shirishdawane's Avatar
    Join Date
    Dec 2004
    Location
    Mumbai,India
    Posts
    363

    Resolved [RESOLVED] Runtime error 5

    Hello All,

    I am using VB 6.0 with Win 2000 OS. My problem is that I am getting "Runtime Error 5" when I runs project exe on other machine(Win 2000)but it runs smooth on my machine(Win 2000).

    On following Bold line, I am getting an error:

    VB Code:
    1. If txtHostID.Text <> vbNullString Then
    2.         If Val(txtHostID.Text) >= 61569 And Val(txtHostID.Text) <= 63487 Then
    3.             MsgBox "Invalid Host Game ID Number." & vbCrLf & "Range 0xF081-0xF7FF Reserved for Non Configured Games.", vbOKOnly + vbCritical, "Host Game ID Number"
    4.             txtHostID.Text = vbNullString
    5.             [B]txtHostID.SetFocus[/B]
    6.             Exit Sub
    7.         End If
    8.     End If

    Above code is in txtHostID_LostFocus() event.
    Last edited by shirishdawane; Oct 17th, 2006 at 09:07 AM.
    On Error GoTo http://www.vbforums.com

    Note :
    1) Please use [vbcode]your code goes in here [/vbcode] tags when posting VB code.
    2) Please mark thread as Resolved using the Thread Tools menu, if you got solution.

  2. #2
    Frenzied Member Andrew G's Avatar
    Join Date
    Nov 2005
    Location
    Sydney
    Posts
    1,587

    Re: Runtime error 5

    Try useing the Validate event instead.

    VB Code:
    1. Private Sub txtHostID_Validate(Cancel As Boolean)
    2.     If txtHostID.Text <> vbNullString Then
    3.         If Val(txtHostID.Text) >= 61569 And Val(txtHostID.Text) <= 63487 Then
    4.             MsgBox "Invalid Host Game ID Number." & vbCrLf & "Range 0xF081-0xF7FF Reserved for Non Configured Games.", vbOKOnly + vbCritical, "Host Game ID Number"
    5.             txtHostID.Text = vbNullString
    6.             Cancel = True
    7.             Exit Sub
    8.         End If
    9.     End If
    10. End Sub

  3. #3

    Thread Starter
    Hyperactive Member shirishdawane's Avatar
    Join Date
    Dec 2004
    Location
    Mumbai,India
    Posts
    363

    Re: Runtime error 5

    Thanx Andrew.....its working

    But I would like to know reason why it is happening?
    On Error GoTo http://www.vbforums.com

    Note :
    1) Please use [vbcode]your code goes in here [/vbcode] tags when posting VB code.
    2) Please mark thread as Resolved using the Thread Tools menu, if you got solution.

  4. #4
    Frenzied Member Andrew G's Avatar
    Join Date
    Nov 2005
    Location
    Sydney
    Posts
    1,587

    Re: Runtime error 5

    I'm not sure why it didn't work. I've tried to reproduce the problem but it didn't seem to come up with the error. It might be a bug or something.

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