Visual Basic (Run-Time Error 13 Type Mismatch)?
Visual Basic (Run-Time Error 13 Type Mismatch)? Hey guys, I'm a bit new to Visual Basic, but what I'm trying to do is to perform a calculation on a certain object (in this case, a combo box), which then, based on certain conditions, will display a number on another label.
After putting code for the 2nd combo box in, it begins to display an error runtime error 13 type mismatch.
Here is my code:
Private Sub cmdCalculate_Click()
If cbo1.Text = 12 Then
lbl1 = Val(cbo1.Text * 5)
End If
If cbo1.Text = 13 And cbo1.Text = 19 Then
lbl1 = Val(60 + cbo1.Text)
End If
If cbo1.Text = 20 Then
lbl1 = Val(79 + 0.1 * cbo1.Text)
End If
If cbo2.Text = 12 Then
lbl2 = Val(cbo2.Text * 5)
End If
If cbo2.Text = 13 And cbo2.Text = 19 Then
lbl2 = Val(60 + cbo2.Text)
End If
If cbo2.Text = 20 Then
lbl2 = Val(79 + 0.1 * cbo2.Text)
End If
End Sub
|