Tag Archives: exception handling

A quick note on error messages

I went to a local museum the other day and when the attendant scanned by membership card his computer said: Object not set to a reference of an object. Because we’re programmers, you and I know what that means (more … Continue reading

Posted in MessageBox, miscellany, user interface | Tagged , , , , , , , , , , , , , | 1 Comment

Define custom exception classes in C#

The example Throw a standard exception in C# explains how to throw exceptions to tell the program about unexpected errors. The example See a hierarchy of exception classes for use in C# lists some useful exception classes. But what if … Continue reading

Posted in coding | Tagged , , , , , , , , , , , , , | Leave a comment

See a hierarchy of exception classes for use in C#

The example Throw a standard exception in C# explains how to throw exceptions to indicate a problem in a program. Throwing an exception is easiest if you can find an existing exception class that correctly represents your situation. The following … Continue reading

Posted in coding | Tagged , , , , , , , , , , , | 2 Comments

Throw standard exceptions in C#

The example Use try catch blocks to protect against unexpected errors in C# explains how to catch an exception and briefly mentions that you can use the throw statement to throw your own exception. This example shows how to throw … Continue reading

Posted in coding | Tagged , , , , , , , , , , , | 2 Comments

Handle DataGridView errors in C#

This example shows how you can handle DataGridView errors when you modify the data in the DataGridView control. The example Build a DataTable and bind it to a DataGridView in C# shows how to use a DataGridView control to display … Continue reading

Posted in controls, database | Tagged , , , , , , , , , , , , , , | 1 Comment

Use try catch blocks to protect against unexpected errors in C#

Most programs cannot anticipate every possible error. You can watch for things like missing files, but it’s hard to stop a determined user from entering “ten” in a TextBox that should contain a number. (Actually you can prevent that by … Continue reading

Posted in debugging, syntax | Tagged , , , , , , , , , , , , , , | 1 Comment