How to replace visual studio 2010 default errors/critical messages?


I want to replace visual studio 2010 default errors/critical messages with my own. Specific message in my application is "duplicate record found".

I want to add code before below one.

Open in new window

In MS access that very easy to replace, for example, Err 2019...
I have add message as picture file.

Thank you in advance for help to anyone.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dirk HaestProject managerCommented:
You should implement a try-catch event
There you can catch all the errors and depending of the error, give you own message

Catch ex As SQLException
   if  ex.ErrorCode == 0x80131904 then
Catch ee As Exception

dejandejanovicAuthor Commented:
Thank you for reply Dhaest. I can not write your solution in right way.

Of course my plan is to prevent entry duplicate value in MSaccess database which has a primary key one of column.

I'm still learning, and this point is very hard.

Can you please assist?
dejandejanovicAuthor Commented:
I have found it by thinking for approx. 2h, but I'm glad I have learned by self.
Let me explain:
1. I have write query FirstNameCount1:
SELECT COUNT(FirstName) AS Expr1, FirstName
GROUP BY FirstName

Open in new window

2. Then added textbox to display query result from query column 3.

3. And in the end simple IF code

TextBox1.Text = qa.FirstNameCount1.Rows(0).Item(2)

Open in new window

  Dim qa = New Duplicate.TESTDataSetTableAdapters.TESTTableAdapter
        TextBox1.Text = qa.FirstNameCount1.Rows(0).Item(2)
        If TextBox1.Text >= 2 Then
        End If

Open in new window

Is there a simpliest way to get a code "find duplicate before enty record" ?
Dirk HaestProject managerCommented:
There are 2 possibility's to perform this:
1. Check if there is already a record with this key (like you did)
remark: I would suggest to take a look at the executeScalar-method to get the count back. It's less overhead and quicker in execution thatn using a dataset

2. Execute the insert-statement and catch the error. (see remark I posted earlier)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dejandejanovicAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.