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 4 1851
Yes, this is included for legacy. Actually the underyling MSIL code for on
error uses Try/Catch...
Try : http://msdn.microsoft.com/library/de...Statements.asp
You are allowed to do nothing when an exception is raised but I would still
double check that I can't do otherwise (bascially it should IMO never be
done, what is your scenario ?).
--
Patrice
"DavideR" <Da*****@discus sions.microsoft .com> a écrit dans le message de
news:4B******** *************** ***********@mic rosoft.com... 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
The "One Error GoTo <label>" part of your VB6 error handling can be converted
automatically to .NET exception handling (download the demo of Clear VB on
our web site to see how).
The stuff that can't be converted easily includes 'On Error Resume Next'
statements. You need to enclose each statement in a try/catch block ("Try"
before the statement, and an empty "Catch" block after the statement). So,
unless your On Error Resume Next is only in effect for a single line or two,
this approach becomes impractical. This code needs to be reworked.
--
David Anton www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter & VB to C++ converter
Instant J#: VB to J# converter
"DavideR" wrote: 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
in some routine like mousemove, graphical drawing etc i sometimes i use
resume next for continue execution of the code for not display a blank screen
(i display an incorrect screen but not blank(this is not my decision but its
so for a long time for customer's impact ! ?!?)
and then i re-establish the herrhandling
So nothing to do?? it's already allright?
Thanks for reply
:?)
"Patrice" wrote: Yes, this is included for legacy. Actually the underyling MSIL code for on error uses Try/Catch...
Try : http://msdn.microsoft.com/library/de...Statements.asp
You are allowed to do nothing when an exception is raised but I would still double check that I can't do otherwise (bascially it should IMO never be done, what is your scenario ?).
-- Patrice
"DavideR" <Da*****@discus sions.microsoft .com> a écrit dans le message de news:4B******** *************** ***********@mic rosoft.com... 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
What kind of errors have you *seen* in this portion of code ?
This is one point where try/cast can help as you can catch only those
exception that are of a given class. This way you can catch errors that
could arise (for example file io errrors when saving a file) but you can
still have more unexpected errors to raise a generic message and warns the
support team.
I wanted to convey the opinion that IMO the worst thing in error hanlding is
to "hide" errors that are not signaleds to the support team and/or the
user...
--
Patrice
"DavideR" <Da*****@discus sions.microsoft .com> a écrit dans le message de
news:4E******** *************** ***********@mic rosoft.com... in some routine like mousemove, graphical drawing etc i sometimes i use resume next for continue execution of the code for not display a blank
screen (i display an incorrect screen but not blank(this is not my decision but
its so for a long time for customer's impact ! ?!?) and then i re-establish the herrhandling So nothing to do?? it's already allright? Thanks for reply :?)
"Patrice" wrote:
Yes, this is included for legacy. Actually the underyling MSIL code for
on error uses Try/Catch...
Try : http://msdn.microsoft.com/library/de...Statements.asp You are allowed to do nothing when an exception is raised but I would
still double check that I can't do otherwise (bascially it should IMO never be done, what is your scenario ?).
-- Patrice
"DavideR" <Da*****@discus sions.microsoft .com> a écrit dans le message de news:4B******** *************** ***********@mic rosoft.com... 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: DraguVaso |
last post by:
Hi,
I want my application do different actions depending on the exception it
gets.
For exemple: I have an SQL-table with a unique index. In case I try to
Insert a record that's alreaddy in it I get this exception: "Cannot insert
duplicate key row in object 'tblTelephones' with unique index
'UniqueValues'."
What I'm looking for is a way to identify the exception: in case I get this
|
by: matthew.schneider |
last post by:
I have a defined XML Schema, and XML documents containing data that I
validate against it. Periodically, I will have a data document that
will contain extra elements that are not part of my schema. The powers
that be have determined that this is acceptable.
I am looking for the best way to continue to validate my documents
against my schema, but ignore any errors dealing with extra elements.
My first thought is to use a...
|
by: ahaupt |
last post by:
Hi all,
I'm currently writing a load of class libraries, but not the main
application iteslf.
I want to provide some method for reporting errors back to the main
application.
At the moment I have a bool errBl and a string errMsg in my classes.
When errBl is ture, one could see what the error was in errMsg.
|
by: Mike |
last post by:
I have a C# aspx page that calls a C# class file for db access, data, etc.
If one of the "functions" I call in the class has an error how can i pass
that error back to the aspx page and then display it?
|
by: perlet |
last post by:
This is a script I found elsewhere that I was hoping to tweak to do something just a little different. Can't figure out its error. I wouln't mind paying someone to help out if needed to get it to run as I'd like as well.
Thank you.
This is a test page on my site of the same script below:
http://www.personalizedletter.com/Letters/printtest.html
| |
by: petschy |
last post by:
hello all,
i'm writing network message processors for a server app. after
dispatching, the processor function is called for the given message
type. the tokens in the message are validated, checked against the
server state, and if everything is ok, an operation is perfomed, and
optionally a reply is sent back. in some cases of invalid input, an
error message is sent back.
with the naive approach this leads to deeply nested if statements
|
by: lithoman |
last post by:
I'm stumped here. I run the procedure Batch_Select against the database
with @ID=18 and I get the expected data.
When it loads into a SqlDataReader, it gets messed up somehow.
Initially, after the reader.Read(), it has a row with 13 data columns,
but they're all empty. So, my GetInt() function throws an error. When
it jumps to the catch(), reader's columns then show the proper data.
What gives?
I have reader._data (which is the ID...
|
by: Jim |
last post by:
Hello,
I'm trying to write exception-handling code that is OK in the
presence
of unicode error messages. I seem to have gotten all mixed up and
I'd
appreciate any un-mixing that anyone can give me.
I'm used to writing code like this.
|
by: =?Utf-8?B?Q29kZVJhem9y?= |
last post by:
I wrote a method to validate and xml file against a schema.
If the file does not conform to the schema, it throws an error. It works
fine except for one curious thing.
If I try to validate an XDocument (containing schema xml) against a schema
url, it validates successfully..... Has anyone ever seen this before or know
why it does this.
Here is the code:
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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: 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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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.
| |