Post Job Free
Sign in

.Net Java C++ It Net Com Asp.Net Home Post C#

Location:
United States
Posted:
October 12, 2012

Contact this candidate

Resume:

Home Forums Reviews Guides Newsgroups Register Search

Search Forums

Velocity Reviews > Newsgroups > Programming > ASP .Net > Re: QUERY: 'On Error Resume

Next' scope rules

Thread Tools

Re: QUERY: 'On Error Resume Next' scope rules

Kevin Spencer

Guest

Posts: n/a

06-17-2006

Perhaps the reason you haven't seen any discussion about it here is that

although the "On Error" statement is included in VB.Net for those who have

come from a VB6 or VBScript background (I would suppose), it is not

recommended to use it. ASP and ASP.Net are entirely different technologies.

ASP is purely procedural; ASP.Net is purely object-oriented. In fact, you

are the first person I've ever heard of that has used it.

You might be surprised to learn that the "infamous" try/catch structured

exception handling is part of the .Net specification, and is supported by

VB.Net, C#, and every other .Net language (AFAIK). It is far better to use

try/catch than to use "On Error." You can find it documented here:

http://msdn2.microsoft.com/en-us/library/fk6t46tz.aspx

--

HTH,

Kevin Spencer

Microsoft MVP

Professional Chicken Salad Alchemist

I recycle.

I send everything back to the planet it came from.

"dhruba.bandopadhyay"

wrote in message news:. com...

>

> This has been puzzling me for very long time and no where has

> talked about the scope of a 'On Error Resume Next' statement.

>

> When we program ASP(.NET) pages then we usually like to let

> ASP(.NET) stop at errors and report back to us. However there

> are parts of our scripts that we know an error will be thrown

> and we encapsulate that area inbetween:

>

> On Error Resume Next

> Err.Clear

> 'Try block

> If Err.Number Then

> 'Catch block

> End If

> On Error GoTo 0

>

> This is similar to the infamous try {} catch(e) {} blocks in

> Java/C++, etc.

>

> If we forget the last line 'On Error GoTo 0' then our ASP(.NET)

> scripts runs over all errors thrown and we find it hard to

> find bugs. So the big question is, does 'On Error Resume Next'

> go out of scope when it's written inside a block

> (eg. Function)?

>

> Function Function1 > On Error Resume Next

> 'Our code

> End Function

>

> When the Function1 call returns, does the outside calling scope

> automatically stays as it was (On Error GoTo 0)?

>

>

>

> --

> dhruba.bandopadhyay

>

> Posted via http://www.codecomments.com

>

>

Kevin Spencer

" Dynamic LinkButton, ViewState Task list "

Thread Tools

Show Printable Version

Email this Page

Posting Rules

You may not post new threads

You may not post replies

You may not post attachments

You may not edit your posts

BB code is On

Smilies are On

[IMG] code is On

HTML code is Off

Trackbacks are Off

Pingbacks are Off

Refbacks are Off

Forum Rules

Similar Threads

Thread Thread Starter Forum Replies Last Post

C++ Scope Rules muler C++ 1 11-03-2010 11:33 AM

scope rules in enums Roedy Green Java 4 07-10-2009 01:13 PM

Scope rules n2xssvv g02gfr12930 C++ 3 07-20-2006 02:20 PM

Scope Rules fctk C Programming 3 04-18-2006 11:03 AM

Scope rules ****************@*******.*** C++ 3 09-15-2005 12:51 AM

Advertisments

Powered by vBulletinr Version 3.8.6

Copyright c2000 - 2012, Jelsoft Enterprises Ltd..

SEO by vBSEO 3.5.2 c2010, Crawlability, Inc.

Contact Us - Archive - Privacy Statement - Top

123456789

**-**-**-**-**-** **-**-**-**-**-** **-**-**-**-**-** **-**-**-**-**-**

**-**-**-**-**-** **-**-**-**-**-** **-**-**-**-**-** **-**-**-**-**-**



Contact this candidate