Tema: Validar mail
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/09/2006, 10:22
Avatar de fonchi
fonchi
 
Fecha de Ingreso: septiembre-2006
Ubicación: Concepción
Mensajes: 170
Antigüedad: 18 años, 7 meses
Puntos: 0
Validar mail

Hola:
Necesito alguien que me pueda ayudar con el siguiente problema. Resulta que tenemos un codigo en visual basic para validar mail, todo funciona bien hasta que llego al punto algo, este codigo acepta,que se ingresen sin el punto algo(ejemplo: xxxx@xx esto lo acepta y no deberia hacerlo).

Si alguien me puede ayudar a solucionar el problema lo agradezco de antemano, ya que hemos intentado solucionarlo y no hemos podido.

Chao y Gracias.


If Index = 7 Then
Dim con
Dim v

If valor(7).Text = "" Then
v = 0
Else

valor(7).Text = LCase(valor(7).Text)

If (Left(valor(7).Text, 1) = "." Or Left(valor(7).Text, 1) = "@") Then
v = 1

Call MsgBox("Correo Mal Ingresado", vbCritical, "Aviso")

valor(7).SetFocus

Else

If (Right(valor(7).Text, 1) = "." Or Right(valor(7).Text, 1) = "_" Or _
Right(valor(7).Text, 1) = "@") Then
v = 1
Call MsgBox("Correo Mal Ingresado", vbCritical, "Aviso")

valor(7).SetFocus


Else
If (con = 0) Then
con = 0

For i = 1 To Len(valor(7).Text)
If (Mid(valor(7).Text, i, 1)) = "@" Then
con = con + 1
End If
Next

If con > 1 Or con = 0 Then
v = 1
Call MsgBox("Correo Mal Ingresado", vbCritical, "Aviso")

valor(7).SetFocus
End If

Else
If (con = 0) Then
con = 0

For i = 1 To Len(valor(7).Text)
If (Mid(valor(7).Text, i, 1)) = "@" Then
For j = i To Len(valor(7).Text)
If (Mid(Text1.Text, j, 1)) = "." Then
con = con + 1
End If
Next
End If
Next

If con < 1 Then
v = 1
Call MsgBox("Correo Mal Ingresado", vbCritical, "Aviso")

valor(7).SetFocus
End If


Else
If (con = 0) Then
con = 0

For i = 1 To Len(valor(7).Text)
If (Mid(valor(7).Text, i, 1) = ".") Or (Mid(valor(7).Text, i, 1) = "@") Then
If (Mid(valor(7).Text, i + 1, 1) = ".") Or (Mid(valor(7).Text, i + 1, 1) = "@") Then
v = 1
Call MsgBox("Correo Mal Ingresado", vbCritical, "Aviso")

valor(7).SetFocus
End If
End If
Next



For i = 1 To Len(Text1.Text)
If (Mid(valor(7).Text, i, 1) < "a" Or Mid(valor(7).Text, i, 1) > "z") And _
(Mid(valor(7).Text, i, 1) < "0" Or Mid(valor(7).Text, i, 1) > "9") And _
Mid(valor(7).Text, i, 1) <> "." And Mid(valor(7).Text, i, 1) <> "_" And _
Mid(valor(7).Text, i, 1) <> "@" Then
v = 1
Call MsgBox("Correo Mal Ingresado", vbCritical, "Aviso")

End If
Next


Else
If (valor(7) <> "") Then
v = 2
Call MsgBox("Correo Ingresado Correctamente", vbInformation, "Aviso")


End If
End If
End If
End If

End If
End If
End If
End If