This Visual Basic code defines a form with three text boxes and three buttons. When button one is clicked, it takes the value entered in text box one, divides it by 100 to calculate quantity, calls the PRECIO function to calculate price based on quantity, and displays the results in text boxes two and three. Button two clears all text boxes, and button three closes the form. PRECIO returns different price calculations based on quantity thresholds.
This Visual Basic code defines a form with three text boxes and three buttons. When button one is clicked, it takes the value entered in text box one, divides it by 100 to calculate quantity, calls the PRECIO function to calculate price based on quantity, and displays the results in text boxes two and three. Button two clears all text boxes, and button three closes the form. PRECIO returns different price calculations based on quantity thresholds.
This Visual Basic code defines a form with three text boxes and three buttons. When button one is clicked, it takes the value entered in text box one, divides it by 100 to calculate quantity, calls the PRECIO function to calculate price based on quantity, and displays the results in text boxes two and three. Button two clears all text boxes, and button three closes the form. PRECIO returns different price calculations based on quantity thresholds.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click, Button2.Click Dim Q As Integer Q = TextBox1.Text TextBox2.Text = CANT(Q) TextBox3.Text = "$" & PRECIO(Q) End Sub
Function CANT(ByVal Q As Integer) As Integer
CANT = Q / 100 End Function
Function PRECIO(ByVal Q As Integer) As Integer
Dim P As Integer If Q > 100 & Q <= 1000 Then P = Q * 30 / 100 ElseIf Q > 1000 & Q <= 10000 Then P = Q * 28 / 100 Else P = Q * 26 / 100 End If PRECIO = P End Function
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles
Button2.Click TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles