Dim var As String
'valida que solo se ingresen numeros en el textbox1
Private Sub textbox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If Not IsNumeric(e.KeyChar) Then
e.Handled = True
End If
End Sub
'valida las cantidades del textbox1 y concatena los datos en la variable var
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
If TextBox1.Text = Nothing Then
Exit Sub
Else
If Convert.ToInt32(TextBox1.Text) > 6 Or Convert.ToInt32(TextBox1.Text) < 1 Then
MsgBox("Ingrese un valor entre 1 y 6")
TextBox1.Text = Nothing
TextBox1.Focus()
Else
var = TextBox1.Text & "-" & TextBox2.Text & "-" & TextBox3.Text
End If
End If
End Sub
'valida que solo se ingresen numeros en el textbox2
Private Sub textbox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
If Not IsNumeric(e.KeyChar) Then
e.Handled = True
End If
End Sub
'valida las cantidades del textbox2 y concatena los datos en la variable var
Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged
If TextBox2.Text = Nothing Then
Exit Sub
Else
If Convert.ToInt32(TextBox2.Text) > 18 Or Convert.ToInt32(TextBox2.Text) < 1 Then
MsgBox("Ingrese un valor entre 1 y 18")
TextBox2.Text = Nothing
TextBox2.Focus()
Else
var = TextBox1.Text & "-" & TextBox2.Text & "-" & TextBox3.Text
End If
End If
End Sub
'valida que solo se ingresen numeros en el textbox3
Private Sub textbox3_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox3.KeyPress
If Not IsNumeric(e.KeyChar) Then
e.Handled = True
End If
End Sub
'valida las cantidades del textbox3 y concatena los datos en la variable var
Private Sub TextBox3_TextChanged(sender As Object, e As EventArgs) Handles TextBox3.TextChanged
If TextBox1.Text = Nothing Then
Exit Sub
Else
If Convert.ToInt32(TextBox3.Text) > 12 Or Convert.ToInt32(TextBox3.Text) < 1 Then
MsgBox("Ingrese un valor entre 1 y 12")
TextBox3.Text = Nothing
TextBox3.Focus()
Else
var = TextBox1.Text & "-" & TextBox2.Text & "-" & TextBox3.Text
End If
End If
End Sub