Results 1 to 6 of 6

Thread: Message Box Fork

  1. #1

    Thread Starter
    New Member Ryu's Avatar
    Join Date
    May 2002
    Location
    Japan... I wish. Canada...
    Posts
    7

    Message Box Fork

    Im trying to get a message box to display a Yes or No question and depending on the answer, will operate a function.

    Its not working properly, and I dont know why. my code is as follows:

    VB Code:
    1. Private Sub Form_Load()
    2.  
    3. Msgbox "Have you played this game before", vbYesNo, "Attention!"
    4.  
    5. If (vbMsgboxResult.vbNo = "No") Then
    6.  
    7. cmd_hack.Enabled = False
    8. cmd_start.Enabled = False
    9.  
    10. End If
    11. End Sub

    It's giving me an error message when I press No... I think its something with the If statement... could anyone possibly help?

  2. #2
    Zaei
    Guest
    Code:
    If MsgBox(...) = vbNo Then
    ...
    Z.

  3. #3

    Thread Starter
    New Member Ryu's Avatar
    Join Date
    May 2002
    Location
    Japan... I wish. Canada...
    Posts
    7
    heh, I just figured it out doing it a different way.

    But thanks anyways ^_^

  4. #4

    Thread Starter
    New Member Ryu's Avatar
    Join Date
    May 2002
    Location
    Japan... I wish. Canada...
    Posts
    7
    Actually, Im having a new problem now.

    When I click yes, it performs the same function that no would do. My code is as follows.

    VB Code:
    1. Private Sub Form_Load()
    2.  
    3. MsgBox "Have you played this game before?", vbYesNo, "Attention!"
    4.  
    5. If VbMsgBoxResult.vbNo = vbNo Then
    6.  
    7. cmd_hack.Enabled = False
    8. cmd_start.Enabled = False
    9.  
    10. Else
    11.  
    12. If VbMsgBoxResult.vbYes = vbYes Then
    13.  
    14. cmd_hack.Enabled = True
    15. cmd_start.Enabled = True
    16.  
    17.  
    18. End If
    19. End If
    20. End Sub

  5. #5
    Zaei
    Guest
    Remove the If statement in the Else statement.

    Z.

  6. #6

    Thread Starter
    New Member Ryu's Avatar
    Join Date
    May 2002
    Location
    Japan... I wish. Canada...
    Posts
    7
    I have it like this now:

    VB Code:
    1. Else
    2.  
    3. VbMsgBoxResult.vbYes = vbYes
    4.  
    5. cmd_hack.Enabled = True
    6. cmd_start.Enabled = True

    Its saying the .vbYes =

    "assignment to constant not permitted."

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