473,403 Members | 2,270 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Error Trapping in a VB.NET program

Hi:

This is a newby question!

I have written my first VB.NET windows application and I would like to have
a routine that is called if a run time error should occur anywhere in the
program. The docs that I have found only discuss the try & catch structure
which is not what I'm looking for.

Also the "on error goto" doesn't appear to be what I need either as its
required in each subroutine.

(In VB.NET web apps there is a way to do this.)

Is there a way to specify an error handler for an entire VB.NET program? I
would appreciate it if anyone could point me in the right direction.

Thanks,

Fred
Nov 21 '05 #1
2 1305
Put an On Error Goto in sub Main(). This will catch all errrors that come
up. Also, make sure sub Main() stays in memory by showing your main form
MODAL.

Mike Ober.

"Fred Nelson" <fr**@smartybird.com> wrote in message
news:%2***************@TK2MSFTNGP14.phx.gbl...
Hi:

This is a newby question!

I have written my first VB.NET windows application and I would like to have a routine that is called if a run time error should occur anywhere in the
program. The docs that I have found only discuss the try & catch structure which is not what I'm looking for.

Also the "on error goto" doesn't appear to be what I need either as its
required in each subroutine.

(In VB.NET web apps there is a way to do this.)

Is there a way to specify an error handler for an entire VB.NET program? I would appreciate it if anyone could point me in the right direction.

Thanks,

Fred

Nov 21 '05 #2
"Fred Nelson" <fr**@smartybird.com> schrieb:
I have written my first VB.NET windows application and
I would like to have a routine that is called if a run time error
should occur anywhere in the program.


<URL:http://groups.google.de/groups?selm=...2MSFTNGP09.phx
..gbl>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Wugi | last post by:
I'm trying to find an equivalent of key-event trapping which is easy in QBasic. Several of my programs build up a geometric figure with two parameter line families, eg with two nested for..next...
13
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
13
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...
3
by: Smriti Dev | last post by:
Hi There, I have the following code and when I try to run it, I get a type mismatch error. I would really appreciate your help with this. Thanks kindly, smriti --- Private Sub cmdOK_Click()
2
by: Bill Stock | last post by:
I have a subform which is causing a 3314 (Field can't contain a null value because required is set to True) error. I solved this problem by trapping it in the before update event. But then I...
2
by: Captain Nemo | last post by:
I'm still using Office 2000 myself, but some of my clients have Office 2003. I've recently added a piece of code to create an instance of Word, open a document, fill in the blanks and become...
0
by: JohnJohnUSA | last post by:
I ran the following program to retrieve entries from the windows registry on Windows XP: import win32api, win32con aReg = win32api.RegConnectRegistry(None, win32con.HKEY_CURRENT_USER) aKey =...
9
by: 47computers | last post by:
Pretty new to PHP, I recently started learning about error trapping. As of right now, I include the following into a page in my website: -------BEGIN PASTE-------- error_reporting(E_ERROR |...
94
by: Chad | last post by:
On to top of page 163 in the book "The C Programming Langauge" by K & R, they have the following: char *strdup(char *s) { char *p; p=(char *)malloc(strlen(s)+1); if( p != NULL) strcpy(p,s):...
20
by: miroku800 | last post by:
I don't know if this should be here or in an Access forum but here goes I have a VB6 program that uses an access database to record competitors and scores from a competion this works fine and i...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
0
BarryA
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
Oralloy
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
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,...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.