Results 1 to 12 of 12

Thread: Using the IF and THEN statement. {RESOLVED}

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member stilekid007's Avatar
    Join Date
    Apr 2005
    Location
    DUDE! I'm your neighbor! HELLO!!!
    Posts
    388

    Using the IF and THEN statement. {RESOLVED}

    Hello,

    How do I get this code to work. What it is supposed to do is if the Option button "Down" is pressed it will do the correct code for that but if the Option button "Up" is pressed it will do what was selected for that. However the code below only works if the Option "UP" is selected. Does anyone see what I am doing wrong?

    VB Code:
    1. Private Sub cmdCalc4_Click()
    2. Dim X3 As Long
    3. Dim y3 As Long
    4.  
    5. If [B]OptUp.Value [/B] = True Then
    6. If lnHigh.Y1 > lnLow.Y1 Then
    7. ln146.Y1 = (lnHigh.Y1 - lnLow.Y1) * 0.146 + (lnLow.Y1)
    8. ln146.Y2 = (lnHigh.Y1 - lnLow.Y1) * 0.146 + (lnLow.Y2)
    9. lbl146.Caption = frmMain.Text1.Text
    10. Else
    11. ln146.Y1 = (lnHigh.Y1 - lnLow.Y1) * 0.146 + (lnLow.Y1)
    12. ln146.Y2 = (lnHigh.Y1 - lnLow.Y1) * 0.146 + (lnLow.Y2)
    13. lbl146.Caption = frmMain.Text1.Text
    14. End If
    15. ln146.X1 = Picture1.Left
    16. ln146.X2 = Picture1.Width
    17. ln146.Visible = True
    18. X3 = (Picture1.ScaleWidth - Picture1.ScaleLeft) / 2
    19. y3 = ln146.Y2 + 0.8
    20. lbl146.Move X3, y3
    21. lbl146.Visible = True
    22. End If
    23.  
    24. If [B]Optdown.Value[/B] = True Then
    25. If lnHigh.Y1 > lnLow.Y1 Then
    26. ln146.Y1 = (lnHigh.Y1 - lnLow.Y1) * 0.146 - (lnHigh.Y1)
    27. ln146.Y2 = (lnHigh.Y1 - lnLow.Y1) * 0.146 - (lnHigh.Y2)
    28. lbl146.Caption = frmMain.Text1.Text
    29.  
    30. Else
    31. ln146.Y1 = (lnHigh.Y1 - lnLow.Y1) * 0.146 - (lnHigh.Y1)
    32. ln146.Y2 = (lnHigh.Y1 - lnLow.Y1) * 0.146 - (lnHigh.Y2)
    33. lbl146.Caption = frmMain.Text1.Text
    34. End If
    35. ln146.X1 = Picture1.Left
    36. ln146.X2 = Picture1.Width
    37. ln146.Visible = True
    38. X3 = (Picture1.ScaleWidth - Picture1.ScaleLeft) / 2
    39. y3 = ln146.Y2 + 0.8
    40. lbl146.Move X3, y3
    41. lbl146.Visible = True
    42.  
    43. End If
    44. End Sub

    Thank you and have a great day!
    Stilekid007
    Last edited by stilekid007; Jun 21st, 2005 at 07:28 PM.

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