Home Forum
 

Error Handling in VB

From source code,code examples

Jump to: navigation, search
Automatic error handling tool

Automatic Err handling tool:

Auto Error Handler

this is an addin for VB that will insert Error handling code with the press of a button. I can't take all the credit for this as I found some of the code on PSC, but I have addapted this to allow you to define the Error code that will be inserted.To change the error code goto Autoerrorhandler on the tools menu! Try it out, it might save you a lot of time, or at least give you something to do for a few minutes.

Application record and playback

This code allows you to record the interaction between the user and application and then play it back later. This allows you to implement rudimentary macros and automation to your existing applications without extensive changes.

Application Logger

This class provides a logging object that you can create and destroy as you like, the properties it has are:

Active Debugger

Active Debugger is intended to debug applications by using it as run time debugger by print ing valuable information onto debugger's screen such as variable contents, current state of any object etc. to find and debug the bugs in softwares

a prank prgram

a prank prgram which randomply moves mouse pointer over the screen.to exit press any key....

AddProcedure

This is a addin that I wrote while working on a major project that needed many classes and repeated code. It will insert a sub, function and property with error handling. You can select private or public. If it is a class or a form. You can create a user defined type in a class, select it and it will create the properties for it. Give it a try.

Auto Generate Error Report - Submit By Email

This will open a window when a bug is reported in the code and the user can submit the code by email to the programmer if the user wishes.

Anti Debug

Basicly this piece of code protect your program to be debugged... this is also a interesting example about how to use threads in VB (without crash it)

SuperLog

Allows you to quickly and easily create and write to log files.

Commentor 1.1

Comments and adds error handling to your projects

C Style Project Explorer Add-in

Acts as a C style project explorer for the active VB project.

Log File Creator/Viewer

I wrote this Code to Log actions within a game that I'm writing (keep track of Users logging in, out, etc).

CError.cls

Formats, Displays and logs Error Information. Retains Error State across system calls allowing cleanup to occur without losing the error information.

Erl

Checking Where Errors Occurs

Error handling in Visual Basic

My intention with this WP is that there shall be a little some thing for every body between "New Bee" and "Guru."

Error Class

I've written a class which you can use to handle all errors within your own code. The class displays the error to the user giving them a choice of retrying the line that caused the error again, ignoring the error or aborting the program. All errors raised are written to a log file in the same folder as the application for future reference. Also all errors raised in a session are stored within the class - this could be used by the end program as neccessary.

clsEBApplicationLog

An easy to use application logging class. Writes custom messages to a log file - useful for debugging problems on remote machines.

Code Completer

Addin for inserting ErrorHandlers and Error-Numbers to your VB-Project, also logs errors. There are three types of ErrorHandlers: Message boxes for Applications, Raise Errors for Com-Objects and modules, Raise Errors for MTS-Objects.

Log Those Errors

The purpose of this code is to save the important data when an error occurs. For example...when launching a new project you might not be able to be around every user. Therefore, when an error occurs it is written to a database capturing the User's Name, the sub and form the error occured on, the error number and description and the date and time of the error. This allows you to track down the error quickly!

Complete Error Handler

This is a complete error handler that you may compile into a DLL and add to any application. There are a number of options for handling errors, such as adding to a custom error stack (with or without displaying a message to the user) and writing to a log file. Handling errors has never been easier!!

RMTLogLib

UPDATED 12-10-99 - There's also a brand-new entry for this.

something to register mswinsock.ocx

it register mswinsock.ocx so you dont get that d?mn error when you use the ocx

CErr Error Class

Using the CErr class in your error handling routines gives you a way to collect error information in a standard way which can be easily extended to give comprehensive reporting with respect to your software's errors.

Coders Assistant v2.5

Program for BYTE manipulation in real time. Allows user to perform CPU operations on two bytes, displaying the result in real time. Also a great tool for learning Binary and Hexidecimal numbering systems.

The Almost Advanced Error Handler Addin

WARNING VB6 ADD-IN (This Will Not Work in VB5 as far as i know)

VB Fixer

VERY VERY Simple -- I got tired of downloading project files and having to manually take out the Retained=0 line from the project file to use in VB 5.0 -- This does that for you..simple code, simple process

Error Dictionary

The code is for a program to look up error numbers and find a more easy to understand description of that error. Very good for debuging

Line Program V2

This application will take a folder containing a VB project(all forms, modules, classes) and line number the entire project for use with error handling! I have corrected the .dll problem 02/14/00.

Validation.bas

Forces the user to complete either textbox combobox or listbox if they do not not and tab out(control loses focus) then a message is displayed and the relevant control changes color. Can be enhanced to make other checks

Capture Debug info from Compiled Applications

This application and companion module will allow you to continue capturing debug info from your application as well as uniquely continue capturing debug info from your application after it is compiled. But I really wouldn't leave it in your code upon distribution.

AIM 3.5.1808 Anti Punt Patch

This is the source Code for "The Patch" Bug Fix For AIM 3.5.1808. See Attached TxT File For More Information

Quick Debug Window

Quickly make a debug window for your app. Just call the sub with the properties and tell it what form the debug window is and it will put the log in a list box. Also has an error rating. Green - good, Yellow - medium, Red - Bad.

ErrorT

Dieses Programm versieht ein VB-Projekt mit Fehlerbehandlungsroutinen. Die zu impfenden Subs,Forms,Functions und Module k?nnen frei gew?hlt werden. Ebenso der Code der als Fehlerbehandlung eingesetzt wird.

ErrorT (English version)

This is the brand new English version of my project. As many of you wanted me to translate it, i tried to do. So here it is...

Clean Code

This code is a VB6 Add-on that, when compiled as a Dll into your VB directory will place itself in the Add-ons menu. When run, it will open up a window showing you all the variables you have declared but have not used anywhere. why would you want to know this? I work for a company writing a VB app that is 600,000 lines long right now. you can save yourself about 8 megs of memory consumption this way.

Debugging console

If you ever disliked all the annoying messageboxes that popup from time to time while you're debugging your projects, then this is for you. It colorcodes each entry it makes for quick finding. This is a very watered down version than other ones I've come up with, but it's good for demonstration purposes.

Duping the Debugger detection

You still want to debug your own programs you designed and not have your own devised protection scheme get in the way. I know the easy way would be to remove the scheme or disable it, however once you compile it to an EXE that becomes a little difficult. You want to be able to run it in an environment intactand still debug it.

Debugging Module (1.0b)

This is a module I use in all my 'release-quality' apps. It implements debugging by using a call stack, and a heap of methods for reporting information. Nothing too flashy, just a handy little module. Please vote & comment. Merry Christmas! -- Update 1.0b -- I must apologize to EVERYONE who downloaded this code; there was a huge mistake in there, left over from the previous version. It's fixed now, and I also fixed the order that the debugger prints out the stack. That'll teach me to just up and 'integrate' my stack class into the module without looking at the stack class :P

DTgis Debugger

The purpose of this code if to have a class to improve the debugging process, telling you where sub or funtion are you in and out.

DX7 Error logging

This code is for figuring out just why your DirectX 7 program keeps crashing. It takes the error codes visual basic generates and deciphers them into meaningful messages so you can fix your code easily and quickly.

Debugging

Every day I have to help people fix their code. I'm amazed every time at how easy the bugs usually are to find, and always learn that the person didn't even make an attempt at debugging their code, because they simply don't know how. So I wrote up this quick pdf file to try to explain some of the key debugging techniques to all the newbies out there.

Debug Helper

I created this project a while ago to solve a very irritating problem when debuggin some of my applications. I have several applications that continuously process data received from several ActiveX EXE's trough callback functions.

Debugging Class

This is a class which I use with every app I write. It allows for easy and quick logging and call stack tracing. This lets you see what your app is doing without having to dump to the immediate window with debug.print.

Error Trap and Log No Api Calls

This source gives o good ideia on error trapping and handling, when an error ocurs a nice form is displayed to the user with several information, plus it logs to a text file.

EventTracer v223 Add-In

EventTracer is a VB6 Add-In which is a versatile tool for eliminating those nearly impossible to fix bugs.

Error/Registry Demo

This is a simple demo of working with the registry and doing some simple error handling. There is nothing outstanding about this code, but it does show how to use both the registry to store settings and how to trap and display errors. No votes requested (I never request them) but comments are welcome.

Extractor of Function and Commands

Now Fix and Update !! 22-10-2002

Error Catcher

All your application errors are logged to a file and this error log is automatically emailed to you without any user interaction at all. This will help you iron out all the bugs that may be apparent in your program. It is more intruitive than a volatile msgbox and more user friendly than asking the user to submit a bug report especially if the user is a novice. In any case it is unpleasant to subject users to application errors. This ensures an update in your program addresses more errors because when an error happens you will be emailed.

EasyErrorHandler

Reducing Debugging Time

EventTracer v225

EventTracer is very useful VB6 Add-In designed to efficiently add Event Tracing and/or Error Handling to VB6 Source code. Version 2.2.5 mostly adds refinements to procedure line numbering for the Error Handler (see "Readme v225.txt" for details).

Error Handle with Event\File Log with debug info mail support

Catch vb error and :-

Error Handler -RW

This class sets a generic rule for your program to follow in the event of errors. The class is setup to handle all basic trapable errors. The layout of the messagebox i found on here, but i do not remember the authors name.

Error Handling VB6 ( Similar to Windows XP Error Message)

Demo application developed similar to error screen shown in Windows XP

Error Generator

Generate Errors For dubugging purpose

Error Code Checker

Have you ever found yourself wondering what a certain error code meant, and googling or looking on MSDN for the description of an specific error?

FYI: GDI+ Crash in IDE

Generic thunk class added. Using it will negate crash described below and can be used to start GDI+... GDI+ when not shut down properly can crash IDE (maybe XP only. See comments below on test results). For those of you that use unsafe subclassing while in IDE, this effect is very familiar. Read the article below and to test a crash, you can run the zipped project. I, and others, can replicate the crash every time on XP Pro. May be a DLL version issue, may be something else.

GPF Exception Handler

Tired of your favourite VB program crashing because of General Protection Faults? Bad subclassing code? Well... if any unhandled exceptions occur, your program will be able to cope, and even continue running. Please leave a line or two to let me know if this has been useful. Thanks.

GPF Interceptor

This project shows how you can intercept GPFs. Instead of crashing your application in case of a GPF, a PopUp is openend showing error details and giving the user the choice between continuing the buggy application or terminating it in a neat and proper way. (This is based on a previous submission. Tested on WinXP only.)

HuntERR 3.1 Release

URFIN JUS presents HuntERR 3.1 Release

Howto : Never forget your variables again

To judge from some recent submissions, some people forget their variables!

ISBN check

It checks to see if an isbn number that has been entered is valid.

Line Numberer

VB Add-In to Add/Remove line numbers and error handling code into a single module or whole project. Error handler msgbox will include the procedure name and exact line of code causing the error.

logic tracker

Did you ever have problems with writing complex subs and you just couldn't find what was wrong with it? Well I did. For this reason I wrote a program which was able to track variables in the subroutine and write them to a file. As you run the program you'll see that it even indents. It can be used on every subroutine you can think of. I included it as a ZIP to help the explanation.

Logan - IIS LOG to MDB Converter

I just wanna tell everyone out there who needs to convert IIS LOG files into MDB files that there is a program out there that can do it for you. I downloaded it from http://www.altair2000.net/en/software/software.asp?codename=logan. (I don't make any money or anything off this submission. I'm not related to the owner of this company or anything like that... blah blah blah...)

Line Counter

A Visual Basic IDE add-in that will count the lines of code of any component of open projects. It also presents a basic analysis of both the selected project and the selected component.

Log File

Similar to the VB logfile logging device, This is slightly easier to use because 1: you only have to specify a file and it can start logging, 2: You can make it log errors without you having to type in the details, 3: you can log your own messages, and 4: All you have to do to close the file is refer to a function. The obvious advantage is that it is customisable. Comments and Feedback would be appreciated, votes would be good. :) Keywords: Log LogFile Log Flie Logging Error Errors Error Handling Debugging Customise

Line Numbering Add-In

Add line numbers to your VB project. Ever wanted to know EXACTLY what line an error occured within a function? Not just the error number & description? There is a little known, hidden function: VBA.Erl() which will tell you what line an error occured on. However to get it to work, you have to set up the line numbers manually (or with this easy to use add-in).

Log4VB demo samples

These demo samples show how to provide trace output to the Log4VB trace viewer. This viewer starts a new era of trouble-shooting during development and at the customer site. It allows to inspect the trace output while it is written. All your (COM-)components write to the same trace. Even UI-less applications (Web-services, etc) can be traced this way.

Leaks - Some tips towards prevention

A mini-tutorial highlighting some things you may want to look out for when coding. Also included is a somewhat simplified approach to preventing, detecting and locating memory leaks. Updated... expanded/clarified a few points.

Module Compare

I designed this code for people that work on a VB project with someone else. This program will let you select a source file, and a master file. It will then highlight all the lines in red that aren't in the master file. Its usefull for if two coders are working on the same project, and you need to update your code to his without changing anything you may have added. Please click on the help button after you run it, it will give you some important info.

My Lotto Game

its a lotto game, with many bugs, please help me out with them, email bearfoot802@attbi.com with suggestions or re-writes or code changes.

My Error Handling Module

This is the module that I use to work with error , I am working now to make it Add-In to be used easily.

NC Messenger

its a small chat to use using IP addresss to connect to

EVENT LOG

FOR NT/2000/2003

ProcErrorHandler

This project is the result of me practicing with the VBE object. ProcErrorHandler adds procedures to your module much like the "Tools/Add proceduce" menu option. The difference is that ProcErrorHandler adds error handling code in the body of the procedure.

Preventing Bugs Before They Occur

Wow, I'm writing another tutorial for Beginner, Intermediate, and Advanced. I hope that this tutorial will help like all my others did. In this tutorial, I will attempt to explain how to prevent bugs before they occur. How, you may ask? Well, I will explain to you bug preventing techniques like using Option Explicit, applying the KISS and SMILE principles, taking advantage of Object-Oriented Programming, using Comments and Coding Conventions, and following Coding Conventions by using Variable and Routine names and avoiding certain statements. I will also throw in what I call the Ten Commandments of being a Lazy Programmer. Is being a 'Lazy Programmer' good? Well, yes it is and you'll find that out soon enough! Maybe some of you are already 'Lazy Programmers'. So, without further eddo, lets begin!

Performance Analyser

Ever had a time when you cant figure out which alogrithm is fastest ? Well i know i have, thats why i created this small little application where you can can run & test upto 4 variations of your code.

Procedure Stack Debugging Tool

clsProcedureStack keeps track of the various procedures your program has used to get to the point it is currently at, and produces a list of the path taken. The output looks something like: frmMain->cmdGo_Click->SavePassword. This allows you to trace through your code to see precisely how an error occurred.

PHP Code Formatter

This code indents php code that you enter, only if it is properly done, (no syntax errors). it will probally do any language set out like php

Previous Instance Form Display Triggering

Ever see some of these professional applications, perhaps running in the tray that show them selves if the program is executed again yet their is no error generated & wonder how they done it. This is a simple example of one way it can be done. I worked this out for a tray application I am working on . I never seen anything like it posted before so I thought it was slick enough to share.

Stack Walking with Line Numbers and Symbols

Stack walk and get line numbers / symbols from a exception. Using raise exception to walk from a specified point. Will only partially work in ide, fully in exe. Need create symbolic info on which makes a pdb that must be in the same directory and have the same name as the exe. Includes goodies like symbol start/stop in functions, safe memory copying, better exception handling, and so forth. Clean and solid code. Not for the inexperienced (I am not kidding). Used a few safe workarounds as well. Line #'s are not effected by comments/spacing. The first symbol will be raise exception if you are calling it or the function that caused a exception. It provides file name, module/form, function (symbol). Very good for debugging.

Simple Error Handler

This is a simple error handler that I put together to return simple debug information.

SQL Parser

You can paste in an SQL statement, and have it formatted into an easier to read format. This is useful for debugging if your program dynamically generates a long SQL statement. Just debug.print your SQL statement, and copy and paste it into the "Input" of the SQL Parser. The formatted SQL statement will appear in the "Output". Some formatting options are available. This is a simple 1-form, no module program.

Super Error Handler

A Super Error Handler, easy, fast, professional.

TSQL Debugging Made Easy

Ever wondered how to debug a Stored Procedure (SP) in MS SQL Server from VB development environment? Ever wished you could debug an SP step by step as you do with VB codes? This article explains how to make the TSQL Debugger work the way you wanted.

Tip on ErrorHandling

This code shows you how to use around six methods, in non-database programmes

UPDATE An Accurate Way To Prevent Runtime Errors

My last Submission on this small application was terrible, i hope never to have this happen again, the code has totally changed from the previous Version, it now Alerts the user with a message box and states the Error Number and Description, Then has the option to Report the Bug... Which is what i think all those people who left me with messages wanted =)...

Understanding : On Error Goto

Generates 'VB Errors' Trapped & Un-Trapped

User Control First Code Generator

Did you make a usercontrol Before ? if Yes , then i think you got so bored each time you make a new one you have to write codes of properties in various Events .. So i made them to save time and energy and Just enter properties and other options then Click Generate .. You Will see the first code of the UserControl ;) .. Please vote form me ..

Ultimate Error handling for beginers

This helps teach beginers the use of error handling in the simplist way.

VB Project Cleaner

(Version 1.0.5) This small program is not a VB project analyzer, but a VB project cleaner. The purpose is to search for all declarations, variables, constants and procedures unused on Visual Basic 6 projects. I made this program for my use, because I had necessity to free my projects of the accumulated garbage.

Visual Basic Documentor / Documentador de codigo fuente

Muestra la estructura de un programa en Vb 5/6 y permite agregar documentacion interna, luego esta documentacion interna es exportada a WORD para generar un documento de dise?o

wExceptionHandler

wExceptionHandler will let your application be near-bullet proof from crashing for unhandled errors because of bad subclassers, windows GPF's and any other unhandled exceptions.

Windows Kernel Errors

This piece of code generates the Windows Illegal Operations through the Kernel32 lib.

WinSock Error Handler

This puts the extended Winsock error information into a function that will return the Error Code; Error number; Short Description; and Long Description. Nothing fancy, I just had a winsock error and wanted more info on it.

Personal tools