Tema: FAQ's de VB6
Ver Mensaje Individual
  #64 (permalink)  
Antiguo 24/04/2005, 21:34
macape1102
Usuario no validado
 
Fecha de Ingreso: abril-2005
Mensajes: 57
Antigüedad: 19 años
Puntos: 0
hola como puedo obtener la edad por medio de un boton en visual basic?


Private Sub Command1_Click()
If Text1 = "" Then
Else
anos = Format(DateDiff("yyyy", Text1.Text, Date), "#,##0")

If Month(Now) = Month(Text1) Then

If Day(Now) >= Day(Text1) Then
Text2 = anos
Else
Text2 = anos - 1
End If
ElseIf Month(Now) < Month(Text1) Then
Text2 = anos - 1
Else
Text2 = anos
End If
End If

End Sub

Ha el formato del text1 pra ingresar la Fecha de Nacimiento es Ejmplo 05-07-1985