DraguVaso,
A year and a half or two years ago there were a couple big discussions on
this subject, I'm not sure how easy it would be to find those threads in
this newsgroup at
http://groups.google.com...
I generally only use Try/Catch blocks where I have to use a try/catch block,
generally when I am managing a resource, for example a SqlConnection that I
need to be certain I close when I exit a routine. Or I cannot use a method
to avoid the exception (HashTable.Contains to see if the key exists before
using HashTable.Item to retrieve the item).
In .NET there is less of a need to include error handlers in every routine,
for example in Windows Forms applications you can set a global exception
handler that will effectively add a error handler to each of your event
handlers under the covers, this global exception handler can log the error
and allow you app to continue in a predictable manner.
Depending on the type of application you are creating, .NET has three
different global exception handlers.
For Windows Forms look at:
System.Windows.Forms.Application.ThreadException event
Use AddHandler in your Sub Main before you call Application.Run.
For ASP.NET look at:
System.Web.HttpApplication.Error event
Normally placed in your Global.asax file.
For console applications look at:
System.AppDomain.UnhandledException event
Use AddHandler in your Sub Main.
Hope this helps
Jay
"DraguVaso" <pietercoucke@hotmail.com> wrote in message
news:3fcb06e1$0$3240$ba620e4c@reader0.news.skynet. be...[color=blue]
> Hi,
>
> As a former VB-programmer I'm used to the "on error goto"-errorhandling. I
> see that in actually all the VB.NET-samples I can fin people use the[/color]
"Try -[color=blue]
> catch"-errorhandling.
>
> Which of the two is the best? Are there good reasons to use the Try-Catch?
> Will the "on error goto" disapear in the future? Are there any logical
> reasons to use trey-catch? Is it 'better' programming? etc etc :-)
>
> I'm jsut more comfortable with the "on error goto", mostly because I'm[/color]
used[color=blue]
> to it I guess. Any help or reflectiosn regarding this subject would be[/color]
nice![color=blue]
>
> Thanks in advance!
>
>[/color]