Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / January 2006

Tip: Looking for answers? Try searching our database.

on error against try...catch

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DavideR - 11 Jan 2006 14:36 GMT
I have converted a large vb6 program with an add-in that for every routine
gimme
the error handling:
the add-in adds one line on the head of the routine
"if myerrhandle then ON ERROR GOTO HERRHANDLER"
and the herrhandler label at the botton where i write in a logfile  the name
of the routine, the errors and other information
Well setting myerrhandle to true seems that the error handling keeps on
working in
.net is it right? what's the difference from exception handling?
if exception handling is better like i think how can i do to pass from
errhandling to excection handling?
Some times i use on error resume next has got
handling exception an equivalent?
Thasnks
Best Regards
DavideR
Ole Nielsby - 12 Jan 2006 17:01 GMT
>I have converted a large vb6 program with an add-in that for every routine
> gimme
[quoted text clipped - 7 lines]
> working in
> .net is it right? what's the difference from exception handling?

There are several differences.

One of them is, exception handling organizes your code in a more
stringent way - it is known at compile time which error handler will
apply to a piece of code, which eliminates hazards of forgetting to
reset error handling after temporary changes.

Another difference is, exception handling allows an easier filtering of
errors, with handling for exception classes.

Third, cleanup operations are safer and easier with the "finally" thing.

> if exception handling is better like i think how can i do to pass from
> errhandling to excection handling?

This depends on how err handling is used, I don't think there is a
general recipy. However, if most of your error handling is automatically
inserted by mentioned add-in, converting should be no big deal.

You might want to remove all the auto-inserted error handling
for easier spotting of manually inserted error handling that needs
manual conversion.

> Some times i use on error resume next has got
> handling exception an equivalent?

I think the strict  equivalent of "resume next" would be to place each
of the affected code lines in its own try-catch clause.

But you would probably want to wrap only those code lines that
are expected to throw errors, and you should catch only the
errors you expect - so unexpected errors will still show up as
message boxes or log entries or whatever you do with them.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.