The document contains code for a calculator application with text boxes and buttons. Button1 multiplies two numbers, applies a 20% discount, and displays the results. Button2 clears all text boxes. The text box event handlers validate input as numeric or text, and prevent invalid entries. Button3 closes the current form and opens another.
The document contains code for a calculator application with text boxes and buttons. Button1 multiplies two numbers, applies a 20% discount, and displays the results. Button2 clears all text boxes. The text box event handlers validate input as numeric or text, and prevent invalid entries. Button3 closes the current form and opens another.
The document contains code for a calculator application with text boxes and buttons. Button1 multiplies two numbers, applies a 20% discount, and displays the results. Button2 clears all text boxes. The text box event handlers validate input as numeric or text, and prevent invalid entries. Button3 closes the current form and opens another.
Dim descuento As Double = Val(TextBox4.Text * 0.2) TextBox5.Text = Val(TextBox4.Text - descuento) Else MsgBox("Todos los campos obligatorios estan vacios") End If End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles
Button2.Click TextBox1.Text = Nothing TextBox2.Text = Nothing TextBox3.Text = Nothing TextBox4.Text = Nothing TextBox5.Text = Nothing End Sub
Private Sub TextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles
TextBox1.KeyPress If Char.IsLetter(e.KeyChar) Then e.Handled = False ElseIf Char.IsControl(e.KeyChar) Then e.Handled = False ElseIf Char.IsSeparator(e.KeyChar) Then e.Handled = False Else e.Handled = True MsgBox("Este campo no admite caracteres numéricos")
End If End Sub
Private Sub TextBox2_KeyPress(sender As Object, e As KeyPressEventArgs) Handles
TextBox2.KeyPress If Char.IsNumber(e.KeyChar) Then e.Handled = False ElseIf Char.IsControl(e.KeyChar) Then e.Handled = False ElseIf Char.IsSeparator(e.KeyChar) Then e.Handled = False Else e.Handled = True MsgBox("Este campo no admite caracter alfabeticos")
End If End Sub
Private Sub TextBox3_KeyPress(sender As Object, e As KeyPressEventArgs) Handles
TextBox3.KeyPress If Char.IsNumber(e.KeyChar) Then e.Handled = False ElseIf Char.IsControl(e.KeyChar) Then e.Handled = False ElseIf Char.IsSeparator(e.KeyChar) Then e.Handled = False Else e.Handled = True MsgBox("Este campo no admite caracteres alfabeticos")
End If End Sub
Private Sub TextBox4_KeyPress(sender As Object, e As KeyPressEventArgs) Handles
TextBox4.KeyPress e.Handled = True MsgBox("Este campo no acepta entrada de datos") End Sub
Private Sub TextBox5_KeyPress(sender As Object, e As KeyPressEventArgs) Handles
TextBox5.KeyPress e.Handled = True MsgBox("Este campo no acepta entrada de datos") End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles