|
-
May 8th, 2013, 02:01 AM
#1
Thread Starter
New Member
Sigh, I'm stuck again T_T.
Hi, I'm trying to make my programs show 10 in the label if I check 2 checkboxes, which plus 5 each. However, I only get 5 in the label despite the fact that I already checked 2 checkboxes + 5. Please help and thank you.  
Dim dblMon As Double
Private Sub frmOrder_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MessageBox.Show("Welcome to our restaurant.")
End Sub
Private Sub chkOp1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkOp1.Click
If chkOp1.Checked = True Then
lblMon.Text = dblMon + 5.0
ElseIf chkOp1.Checked = False Then
lblMon.Text = dblMon
End If
End Sub
Private Sub chkOp2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkOp2.Click
If chkOp2.Checked = True Then
lblMon.Text = dblMon + 5.0
ElseIf chkOp1.Checked = False Then
lblMon.Text = dblMon
End If
End Sub
End Class
-
May 8th, 2013, 02:50 AM
#2
Re: Sigh, I'm stuck again T_T.
Nowhere do you ever check whether both boxes are checked and add 10. You display either (dblMon) or (dblMon + 5.0) but nowhere do you display (dblMon + 10.0). Start with dblMon, test the first box and add 5.0 if it's checked, test the second box and add 5.0 if it's checked and then display the result. Put that in a method and call it from both event handlers.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|