Hola, apenas estoy iniciando con la programación en visual net, mi problema es que no he podido lograr que el botón para limpiar el formulario y se reinicie correctamente el programa, funcione. Les pido su ayuda, porfavor
Public Class Form1
Dim hombre As String
Dim mujer As String
Dim pasado As String
Dim ninio As String
Private Sub SalirToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SalirToolStripMenuItem.Click
End
End Sub
Private Sub CalcularToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Calcular.Click
If RadioButton1.Checked = True Then
hombre = (Val(TextBox1.Text) * 100)
mujer = hombre - 100
ninio = mujer * 0.9
Label3.Text = ninio & "kg"
If Val(TextBox2.Text) > Val(Label3.Text) Then
pasado = Val(TextBox2.Text) - Val(Label3.Text)
TextBox3.Text = "Su peso esta pasado por " & pasado & "Kg"
ElseIf Val(TextBox2.Text) = Val(Label3.Text) Then
TextBox3.Text = "Felicidades su peso es el ideal"
Else
pasado = Val(Label3.Text) - Val(TextBox2.Text)
TextBox3.Text = "Le faltan: " & pasado & "Kg"
End If
End If
If RadioButton2.Checked = True Then
hombre = (Val(TextBox1.Text) * 100)
mujer = hombre - 100
ninio = mujer * 0.85
Label3.Text = ninio & "kg"
If Val(TextBox2.Text) > Val(Label3.Text) Then
pasado = Val(TextBox2.Text) - Val(Label3.Text)
TextBox3.Text = "Su peso esta pasado por " & pasado & "Kg"
ElseIf Val(TextBox2.Text) = Val(Label3.Text) Then
TextBox3.Text = "Felicidades su peso es el ideal"
Else
pasado = Val(Label3.Text) - Val(TextBox2.Text)
TextBox3.Text = "Le faltan: " & pasado & "Kg"
End If
End If
Calcular.Enabled = False
End Sub
Private Sub GroupBox3_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox3.Enter
If RadioButton1.Checked = False And RadioButton2.Checked = False Then
Calcular.Enabled = False
GroupBox3.Enabled = False
End If
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
If RadioButton1.Checked = True Then
NCalculo.Enabled = True
GroupBox2.Enabled = False
GroupBox3.Enabled = True
Calcular.Enabled = False
TextBox1.Focus()
End If
End Sub
Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
If RadioButton2.Checked = True Then
NCalculo.Enabled = True
GroupBox2.Enabled = False
GroupBox3.Enabled = True
Calcular.Enabled = False
TextBox1.Focus()
End If
End Sub
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar = Chr(13) Then
If TextBox1.Text = "" Then
MsgBox("no capturo nada", MsgBoxStyle.Critical, "E r r o r")
ElseIf Not IsNumeric(TextBox1.Text) Then
MsgBox("Capture estatura en metros", MsgBoxStyle.Critical, "E r r o r")
TextBox1.Text = ""
ElseIf Val(TextBox1.Text) > 2.3 Then
MsgBox("Ha superado el limite permitido", MsgBoxStyle.Critical, "E r r o r")
TextBox1.Text = ""
TextBox1.Focus()
ElseIf IsNumeric(TextBox1.Text) Then
TextBox1.Enabled = False
TextBox1.Text = TextBox1.Text & "m"
TextBox2.Enabled = True
TextBox2.Focus()
End If
End If
End Sub
Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
If e.KeyChar = Chr(13) Then
TextBox2.Enabled = False
TextBox2.Text = TextBox2.Text & "Kg"
Calcular.Enabled = True
End If
End Sub
Private Sub AcercaDeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AcercaDeToolStripMenuItem.Click
Form2.Show()
End Sub
Private Sub NCalculo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NCalculo.Click
End Sub
End Class