[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 251
  • Last Modified:

Change error message in datagrid vb6

I have a datagrid that connect to my sql relational database.  When I pull up the table on my datagrid, if I try to delete a row that has a foreign key I get the error message

"the delete statement conflicted with the reference constraint.....the conflict occurred in database...."

How can I change this error message when someone is trying to unsuccessfully delete a row to something else such as:

"This row cannot be deleted since there are hours already for this user"
1 Solution
You could use the DataGrid Error Event: http://msdn.microsoft.com/en-us/library/aa260544(v=vs.60).aspx
You can catch the dataerror-number, display your own messagebox and then set the response to zero, so that the standard error message does not show

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now