Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Provider component

Status
Not open for further replies.

bclt

Programmer
Mar 13, 2005
363
GR
Hi,

I use the "error provider" component so as to have visual validation of some controls. I'm going to procced to some actions after a button click and if there is no error.

Is there a way to do something like "If form1.hasErrors then ... else {procced}"

Notice that i don't want to set to the button "causes validation" and in e.g textboxes "validated {cancel=true}"


TNx
 
Finally found a way!

Code:
Public Function Check() As Boolean  ' Can use arg: [b]Byref form As Form[/b]
  For Each a As Control in Me.Controls
    If ErrorProvider1.getError([b]{form}[/b].a) <> Nothing then
      'Form has (visible) Error so return false
      Return False
      Exit Function
    End If
  Next
  Return True
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top