Dim shipping As Decimal = 50
Dim price As Decimal
Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
price = shipping + txtPurchasePrice.Text
If price > 50 Then
shipping = 0
End If
MsgBox(("Your Total Price is: " & FormatCurrency(price)))
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
txtPurchasePrice.Text = ""
End Sub
This is an example of a program that will control the heater and AC
Dim temperature As Double
Dim Heat, AC As Double
Private Sub btnTempControl_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTempControl.Click
temperature = txtCalcTemp.Text
If temperature < 72 Then
MsgBox("The Heater is being activated ")
Else
If temperature > 76 Then
MsgBox("The AC is being activated")
Else
MsgBox("the system is idle")
End If
End If
End Sub
Here i am going to demonstrate a clothing size calculator:
Dim age As Double
Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
age = txtAgeInput.Text
If age <= 2 Then
MsgBox("you should go with XS")
Else
If age <= 4 Then
MsgBox("Small")
Else
If age <= 8 Then
MsgBox("Medium is the way to go")
Else
If age <= 12 Then
MsgBox("Large")
Else
If age > 13 Then
MsgBox("XL")
End If
End If
End If
End If
End If
No comments:
Post a Comment