0

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

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by codeorder
0

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.

Edited by codeorder: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.