Jump to content

Error handling in search button

- - - - -

  • Please log in to reply
1 reply to this topic

#1
iswan

iswan

    Newbie

  • Members
  • Pip
  • 5 posts
I need advice for modify my code using here. I am creating function for search data using textbox and button. i want to put an error handling in my code which if the data was not found then it will appear in message box "Data is not found. This function is connected to database. For your info i am using visual studio and sql 2005. Here is my code and i also attach my picture

Private Sub Search_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsearch.Click
Me.StaffBindingSource.Filter = "NAME = '" & Me.txtsearch.Text & "'"
txtsearch.Clear()
End Sub

Attached Files



#2
CommittedC0der

CommittedC0der

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,565 posts
I think what your looking for is a Try...Catch statement. This should help. :)

Visual Basic .NET programming for Beginners - Try … Catch
~ Committed.
A man can be defined by what he does when no one is looking.
Science is only an educated theory, which we cannot disprove.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users