Option Explicit
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