VBSlip 13_1_2015-16



=================================Slip13_1==================================
Write a VB program to design following screen with validation name should contain character only, mobile number should contain only 10 digit, Pin code should contain only 6 digit,email id should contain @, . symbol       .  =============================================================================================


 



















Private Sub Command1_Click()
                Dim str As String
                str = Text4.Text
                If Not InStr(1, "@", str) And Text4.Text <> "" Then
                                If Not InStr(1, ".", str) Then
                                                MsgBox ("All data validated")
                                Else
                                                MsgBox ("Email not contain .")
                                End If
                Else
                                MsgBox ("Email withoun @")
                End If
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
                Print KeyAscii
                Select Case Chr(KeyAscii)
    Case 0 To 9
                                MsgBox ("Only Characters are allowed")
                                KeyAscii = 0
                End Select
               
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
                If Not IsNumeric(Text2.Text &Chr(KeyAscii)) And Not KeyAscii = 8 Then
                                MsgBox ("only Numbers are allowed")
                                KeyAscii = 0 '8 for backspace
                End If
               
End Sub

No comments:

Post a Comment

Note: only a member of this blog may post a comment.