Coming from VB6 to VB.NET, it appears if I opt to use the Try Catch approach
I don't have any way to RESUME from within my catch statement?
What I often do is resolve the problem in my catch statement and then I want
to resume at either the same statement that triggered the error or the
following statement. Perhaps I should not be using Try...Catch approach?
Any suggestions?
Thanks, Rob 5 14080
u can use GOTO statement, not advising you to do so though.
"Rob R. Ainscough" <ro*****@pacbel l.net> wrote in message
news:Oj******** ******@TK2MSFTN GP09.phx.gbl... Coming from VB6 to VB.NET, it appears if I opt to use the Try Catch
approach I don't have any way to RESUME from within my catch statement?
What I often do is resolve the problem in my catch statement and then I
want to resume at either the same statement that triggered the error or the following statement. Perhaps I should not be using Try...Catch approach?
Any suggestions?
Thanks, Rob
I thought GOTO was removed from VB.NET?? Thanks for the suggestion, but
GOTO is something I want to avoid as much as possible.
Rob
"Kovan" <ju********@rog ers.com> wrote in message
news:HF******** *************@n ews04.bloor.is. net.cable.roger s.com... u can use GOTO statement, not advising you to do so though.
"Rob R. Ainscough" <ro*****@pacbel l.net> wrote in message news:Oj******** ******@TK2MSFTN GP09.phx.gbl... Coming from VB6 to VB.NET, it appears if I opt to use the Try Catch approach I don't have any way to RESUME from within my catch statement?
What I often do is resolve the problem in my catch statement and then I want to resume at either the same statement that triggered the error or the following statement. Perhaps I should not be using Try...Catch
approach? Any suggestions?
Thanks, Rob
* "Kovan" <ju********@rog ers.com> scripsit: u can use GOTO statement, not advising you to do so though.
.... and you can still use unstructured exception handling.
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Hi Kovan.....
NOOOooooo..... not goto :(
*ahem*
Hi Rob,
To reolve this, you'll have to place a Try..Catch block around the offensive
line...
Try
Foo()
Bar()
Try
Baz()
Catch ex As Exception
' Blah
End Try
Moo()
Goo()
Catch ex As Exception
' Blah
End Try
Using the old-style error-trapping... i.e. On Error Resume Next is bad
because it's unstructured. Try...Catch...F inally is structured exception
handling and performs better in the managed world.
Structured and Unstructured exception handling can *not* be mixed.
--
HTH,
-- Tom Spink, Über Geek
Please respond to the newsgroup,
so all can benefit
" System.Reflecti on Master "
==== Converting to 2002 ====
Remove inline declarations
"Kovan" <ju********@rog ers.com> wrote in message
news:HF******** *************@n ews04.bloor.is. net.cable.roger s.com... u can use GOTO statement, not advising you to do so though.
"Rob R. Ainscough" <ro*****@pacbel l.net> wrote in message news:Oj******** ******@TK2MSFTN GP09.phx.gbl... Coming from VB6 to VB.NET, it appears if I opt to use the Try Catch approach I don't have any way to RESUME from within my catch statement?
What I often do is resolve the problem in my catch statement and then I want to resume at either the same statement that triggered the error or the following statement. Perhaps I should not be using Try...Catch
approach? Any suggestions?
Thanks, Rob
Tom,
Thanks, I see what you're saying -- will take some restructuring to my
approach. It is hard to undo VB6 habits as they continue to
influence my .NET code.
Rob.
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =--- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Darta |
last post by:
OK- I volunteer to be shot if this question is stupid... BUT, is there
a way to, when you catch an exception in the catch{} handler, resume
to the same line of code that generated an error while you are
debugging within IDE...? Here is an example from VB:
Private SomeFunction ()
On Error GoTo ErrHandler:
MyMethod this, that
|
by: itsupport1 |
last post by:
Hi,
I am importing some records from one table to another table, and due to
Constraints in the destination table, it Throws an Exception and Skip the
Whole Rest of records.
So I did implement the On Error Resume next Statement, to avoid skipping the
process of Inserting the records.
But the Problem is
|
by: Neo |
last post by:
Hello All,
Although, I have read all the advantages of using Try Catch Block
instead of "On error goto", I am still confused what is alternative for
classic "Resume" statement. "Resume" was one of the crucial line in
debugging which let VB programmers go to exact line where error was
thrown.
I still use on error goto instead of try catch since, I want "Resume"
for debugging. Is there any alternative like Resume in VB.net for Try
|
by: fniles |
last post by:
In VB 6.0 in the error trapping, we can do "resume next" to continue on the
next code. How can we do that in .NET with "Try", "Catch","End Try" ?
Thanks
|
by: Neo |
last post by:
I found on error resume next doesn't work in for each... e.g.
on error resume next
for each x in y
'do stuff
next
if you have an error in for each loop, it falls in infinite loop... it
doesn't move to next element... this sad thing but, it's indication
that we must move to try catch instead of on error.
| |
by: Rob R. Ainscough |
last post by:
In VB6 I can use Resume Next to execute the line of coding following the
line that cause an exception. There doesn't appear to be anything similiar
when using Try...Catch -- so how can one resume the next statement when an
error can be ignored?
Thanks, Rob.
|
by: Maxwell2006 |
last post by:
Hi,
I know that this is not a good practice, but I wonder do we have "on error
resume next" in C#?
Thanks,
|
by: kimiraikkonen |
last post by:
Hi,
I want to find out if there's difference between "On Error Resume
Next" error handler and leaving "catch" block empty in a try-catch-end
try block to ignore exceptions which i don't approve of course but
just needed to ask.
Thanks
|
by: sriharikabattula |
last post by:
hi,
i am uploading .doc,.docX,rtf files during registration level and that path can be saved in database(i am using database MYSQL).when user want to see his resume he/she can login and retrive his details by clicking on retrive button.my problem is the code will be working in local system it not working in server.i am attaching my code shown below
using System;
using System.Data;
using System.Configuration;
using System.Collections;...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |