hi
lets assume tou have two textbox and a commandbutton
names txtEmailAddress, txtPhone and txtValidate respectively
i thin this few lines of code shold help
Code:
Option Explicit
Private Sub cmdValidate_Click()
Dim sTemp As String
sTemp = txtEmailAddress.Text
If Not (CheckForAltSign(sTemp) And CkechDotSign(sTemp)) Then _
MsgBox "Please check the email address properly", vbCritical, "Error"
End Sub
Private Function CkechDotSign(sTheString As String) As Boolean
Const sExtenssions As String = ".com.uk.net" ' add more extenssions
Dim i As Integer
Dim sSigEx() As String
sSigEx() = Split(sExtenssions, ".")
For i = 1 To UBound(sSigEx)
If sSigEx(i) = Right$(sTheString, Len(sSigEx(i))) Then CkechDotSign = True
Next i
End Function
Private Function CheckForAltSign(TheString As String) As Boolean
Dim i As Integer
Dim iLenStr As Integer
Dim iNumOfAlt As Integer
iLenStr = Len(TheString)
For i = 1 To iLenStr
If Mid$(TheString, i, 1) = "@" Then iNumOfAlt = iNumOfAlt + 1
If Mid$(TheString, i, 2) = "@." Then Exit Function
If Left$(TheString, 1) = "@" Then Exit Function
Next
If iNumOfAlt = 1 Then CheckForAltSign = True
End Function
Private Sub txtPhone_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 48 To 57, 8
'do nothing
Case Else
KeyAscii = 0
End Select
End Sub
Arowolo