Dear The Expert,
I am new with VB.NET (previously VB6 Developer) .. what I want to ask is simple:
1. What 's the difference between Try .. Catch .. Finally End Try and On Error Goto ErrorHandler ...
2. Which one better?
I need advice
Thanks
Printable View
Dear The Expert,
I am new with VB.NET (previously VB6 Developer) .. what I want to ask is simple:
1. What 's the difference between Try .. Catch .. Finally End Try and On Error Goto ErrorHandler ...
2. Which one better?
I need advice
Thanks
Try..Catch..Finally is used for times you know your code may cause an error, and you know what error it may be.
Its generally good programming practise to stay away from using Goto statements, and I believe this to be also the case with Error handling.VB Code:
Try 'code to cause error Catch 'you can have arguments here, eg: Catch When ErrNum = 5 'code to execute if theres an error Finally 'this code is always executed once the Try or Catch code is finished
Hope this helps..
Phreak