How to get the error number in .net

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hello folks,

Is there a way to get the error number in VB.net Exception class as it was
there in VB6 like

'vb code

if err.Number=1234 then
'some code here
end if

Thanks in advance
 
If all you want, is to be able to perform different actions depending on the
error caught, then just use a try/catch block, with multiple catch's...
for example:
try{ //some code expected to create error }
catch (ExcpetionTypeA e) { //code performed on this type of exception }
catch (ExcpetionTypeB e){ //code performed on this type of exception }
catch(Exception e){ //code performed if is something else }

One thing to remember is to order the exceptions from most specific, to
least specific.
 
Back
Top