[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 406
  • Last Modified:

How to identify the try catch error number?

Hi,

Is there any way to identify the error number return by catch block.

e.g

try
           statments
           staments
Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Error!")
End Try

actually i want to know the error number and then with select case i want to give a friendly message to the user that e.g You are entering duplicate value, etc



0
concern_support
Asked:
concern_support
1 Solution
 
ashraf882Commented:
You can split the ex.Message in catch block. Then write select...case.
0
 
chwong67Commented:
0
 
clintonljCommented:
YES...
The HResult member of  the Exception Object contains the Actual Error Code...
The Message as you're already aware contains the accompanying error Text...
0
 
concern_supportAuthor Commented:
for example how? Can you tell me how to give a friendly message when there is primary/foreign key conflict?
0

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

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