Dim Ctrl As Control
Dim check As Integer
Select Case check

Case check = 1
Ctrl = txtName
If Ctrl.Text = "" Then
validatingControls(Ctrl)
MsgBox("enter text")
ErrorProvider1.SetError(Ctrl, "enter text")
End If

Case check = 2
Ctrl = txtAge
If Ctrl.Text = " " Then
validatingControls(Ctrl)
ErrorProvider1.SetError(Ctrl, "enter text")
MsgBox("enter text")
End If
Case Else
MsgBox("data has been entered")
Me.Close()
End Select

I can spot one error.
Placing..

Dim check As Integer

in the same event as the rest of the code posted, you will always get a

MsgBox("data has been entered")

By Dimming something as an integer, it automatically sets it's self to 0, unless Dimmed as =2, 5, etc...

The rest of the code, i got 6 errors just by copy and pasting, so i would say, nope, your code is not correct.