If I have a Try Catch block that captures an exception in a function located
in a module called by a form, in other words burried in the code, and this
exception is not one that can be corrected, how do I exit the program? I
have a nice messagebox pop up and tell the user that there has been an error
and the program needs to be shut down, but I don't know how to code the shut
down.
Thanks,
Thomas
--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access 3 1179
<th*****@msala.net> wrote in message
news:43**********************@news.newsdemon.com.. . If I have a Try Catch block that captures an exception in a function located in a module called by a form, in other words burried in the code, and this exception is not one that can be corrected, how do I exit the program? I have a nice messagebox pop up and tell the user that there has been an error and the program needs to be shut down, but I don't know how to code the shut down.
Thanks,
Thomas
-- Posted via NewsDemon.com - Premium Uncensored Newsgroup Service ------->>>>>>http://www.NewsDemon.com<<<<<<------ Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
Look up the Application.Exit() method in your MSDN help. I believe that will
do what you want,
--
Peter [MVP Visual Developer]
Jack of all trades, master of none.
<th*****@msala.net> schrieb: If I have a Try Catch block that captures an exception in a function located in a module called by a form, in other words burried in the code, and this exception is not one that can be corrected, how do I exit the program? I have a nice messagebox pop up and tell the user that there has been an error and the program needs to be shut down, but I don't know how to code the shut down.
The best solution is to cleanly shut down the application by closing the
forms, especially its main form. However, this would require access to your
forms' instances in the module. Alternatively you can call
'Application.ExitThread' or similar, but note that this will prevent cleanup
code from being executed.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
I don't understand why you can't just raise the error back to the caller by
using the throw command in VB. Exceptions will always bubble back to the
caller. So, eventually it should get back to the form that originally called
the function. Catch the exception there, display it, and perform a clean
shutdown.
In general, it is better to provide your error handling code in the UI
segment of your code. That way you can centralize your handling and not have
to code many, many error handling routines. Low level functions should just
raise errors and not display them. Leave that to your UI.
"th*****@msala.net" wrote: If I have a Try Catch block that captures an exception in a function located in a module called by a form, in other words burried in the code, and this exception is not one that can be corrected, how do I exit the program? I have a nice messagebox pop up and tell the user that there has been an error and the program needs to be shut down, but I don't know how to code the shut down.
Thanks,
Thomas
-- Posted via NewsDemon.com - Premium Uncensored Newsgroup Service ------->>>>>>http://www.NewsDemon.com<<<<<<------ Unlimited Access, Anonymous Accounts, Uncensored Broadband Access This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: WSeeger |
last post by:
When creating a new class, is it encouraged to always include error
handling routines within your LET and GET procedures? It's seems that
most text books never seem to include much about error...
|
by: Christian Christmann |
last post by:
Hi,
assert and error handling can be used for similar purposes.
When should one use assert instead of try/catch and in which
cases the error handling is preferable?
I've read somewhere that...
|
by: Squirrel |
last post by:
I have a command button on a subform to delete a record.
The only statement in the subroutine is:
DoCmd.RunCommand acCmdDeleteRecord
The subform's recordsource is "select * from tblVisit order...
|
by: Thelma Lubkin |
last post by:
I use code extensively; I probably overuse it. But I've been using
error trapping very sparingly, and now I've been trapped by that.
A form that works for me on the system I'm using, apparently...
|
by: Anthony England |
last post by:
Everyone knows that global variables get re-set in an mdb when an un-handled
error is encountered, but it seems that this also happens when the variable
is defined as private at form-level.
So...
|
by: Stefan Johansson |
last post by:
Hi all
I'am moving from Visual Foxpro and have a question
regarding "best practice" error handling in vb .net.
In VFP I have always used a "central" error handling
object in order to have a...
|
by: Al Williams |
last post by:
Hi,
I have error handling in place throughout my application. I also start the
application wrapped in error handling code to catch any unexpected
exceptions (i.e. exceptions that occur where I...
|
by: Anthony England |
last post by:
(sorry for the likely repost, but it is still not showing on my news server
and after that much typing, I don't want to lose it)
I am considering general error handling routines and have...
|
by: Lysander |
last post by:
Thought I would give something back with a few articles. This article is a bit of code to add error handling. When I have time, I want to write articles on multilingual databases, and Access...
|
by: MrDeej |
last post by:
Hello guys!
We have an SQL server which sometimes makes timeouts and connection errors. And we have an function witch writes and updates data in 2 tables on this server. When the SQL server error...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
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,...
|
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...
|
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...
|
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,...
| |