i am trying to do some computations on vb.net. I used the if else statement since i'm a bit familiar with it. my goes like this
Try
Dim a As Integer = msalary.Text
If (a < 9000) Then
Label5.Text = a - 200
ElseIf (9000 < a < 9999.99) Then
Label5.Text = a - 225
ElseIf (10000 < a < 10999.99) Then
Label5.Text = a - 250
ElseIf (11000 <= a < 11999.99) Then
Label5.Text = a - 275
ElseIf (12000 <= a < 12999.99) Then
Label5.Text = a - 300
ElseIf (13000 <= a < 14000) Then
Label5.Text = a - 325
ElseIf (14000 <= a < 15000) Then
Label5.Text = a - 350
ElseIf (15000 <= a < 16000) Then
Label5.Text = a - 375
ElseIf (17000 <= a < 18000) Then
Label5.Text = a - 400
ElseIf (18000 <= a < 19000) Then
Label5.Text = a - 425
ElseIf (19000 <= a < 20000) Then
Label5.Text = a - 450
ElseIf (20000 <= a < 21000) Then
Label5.Text = a - 475
ElseIf (21000 <= a < 22000) Then
Label5.Text = a - 500
ElseIf (22000 <= a < 23000) Then
Label5.Text = a - 525
ElseIf (23000 <= a < 24000) Then
Label5.Text = a - 550
ElseIf (24000 <= a < 25000) Then
Label5.Text = a - 575
ElseIf (25000 <= a < 26000) Then
Label5.Text = a - 600
ElseIf (26000 <= a < 27000) Then
Label5.Text = a - 625
ElseIf (27000 <= a < 28000) Then
Label5.Text = a - 650
ElseIf (28000 <= a < 29000) Then
Label5.Text = a - 675
ElseIf (29000 <= a < 30000) Then
Label5.Text = a - 700
ElseIf (30000 <= a < 31000) Then
Label5.Text = a - 725
ElseIf (31000 <= a < 32000) Then
Label5.Text = a - 750
ElseIf (32000 <= a < 33000) Then
Label5.Text = a - 800
ElseIf (33000 <= a < 34000) Then
Label5.Text = a - 825
ElseIf (34000 <= a < 35000) Then
Label5.Text = a - 850
ElseIf (a >= 35000) Then
Label5.Text = a - 875
ElseIf a = "" Then
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
the farthest the condition was able to go was to -225 even if i put 20000 in it. it will only subtract 225 from the 20000..is there something wrong on what i did or is there a better way to do it?
Aucun commentaire:
Enregistrer un commentaire