Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2006
    Posts
    1

    Unanswered: vbYesNo Question (help)

    Hi, Im taking an introduction visual basic course and I am having problems with vbYesNo. If "No" is clicked, the program will clear the textbox and allow a new value to be entered, which is what i wanted. But for some reason when the user clicks "Yes" the program will not continue on to the calculation. Does anybody know why this is?? Thanks for your help.


    Code:
    If check1 = True Then 
    
    If Text1(0).Text < 4 Or Text1(0).Text > 9 Then
    
    dummy = MsgBox("Are you sure the value entered for Compound #1 Coefficient A is correct?", vbYesNo, "Value Entered Is Not Characteristic")
       
        If dummy = vbNo Then               
        
                Text1(0).Text = ""
                Text1(0).SetFocus
                check1 = False
                
        ElseIf dummy = vbYes Then
        check1 = True
    Last edited by loquin; 03-10-06 at 16:31.

  2. #2
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    Add a breakpoint to your code, then step through it using the F8 key.

    You can pause the mouse pointer over the variables and constants to see what they contain.

    You might also want to explicitly convert the text box entries to integer, rather than let the VB compiler implicitly convert them to what IT thinks best.

    i.e.
    Code:
    If (CInt(Text1(0).Text) < 4) Or (CInt(Text1(0).Text) > 9) Then
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •