VBSlip 17_2_2015-16



=================================Slip17_2=================================
Write a VB a program to enter “Voters details and on next form display Voter’s Information and  check proper validation for(name, age,nationality) as Name should be in upper case letters Age should not be less than 18 yrs.Nationality should be Indian. ====================================================================
 


Dim age As Integer
Dim vname As String

Private Sub Command1_Click()
                age = Text2.Text
                vname = Text1.Text
               
                If Val(Text2.Text) < 18 Then
                                MsgBox ("Age should be greater than 18")
                ElseIf Text3.Text <> "Indian" Then
                                MsgBox ("Nationality must be Indian")
                Else
                                Form2.Show

                                Form2.Label4.Caption = vname
                                Form2.Label5.Caption = age
                End If
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)

                Select Case Chr(KeyAscii)
                Case "a" To "z"
                                MsgBox ("Only Capital letters are allowed")
                                KeyAscii = 0
                Case 0 To 9
                                MsgBox ("Only Characters are allowed")
                                KeyAscii = 0
                End Select
End Sub
 

2 comments:

  1. First of all Big thanks for sharing this with us. Excellent content with a cool idea, the great content of various kinds of the valuable information.
    dot net coaching center in chennai
    dot net coaching centers in chennai

    ReplyDelete
  2. I feel very grateful that I read this. It is very helpful and very informative and I really learned a lot from it.
    app and you are doing well.



    Dot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery

    ReplyDelete

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