The recommended method to do what you desire is to use a try, catch, block architecture. In your try, you would be performing all of the functions that are typical like your GPIN read and write functions. In the catch portion, you would allow a variable to be set whenever an error occurred using the GPIBexception class members. Then in the block section (optional) you could perform the remaing of the functions if any.
Please take a look at the SimpleReadWrite example in our .NET examples for GPIB by going to the example directory (C:\Documents and Settings\All Users\Documents\National Instruments\NI-488.2\Examples\DotNET3.5\SimpleReadWrite\vb). This example uses the try, catch, block architecture. Also if you look in the MeasurementStudio Help and search for "GPIBexception members" and click on the first item, you'll find the available objects you can call. For your application, you'll probably want to use the ErrorCode property. For this, your catch function should be something like:
According to the provided documentation in the MeasurementStudio help, anytime an error occurs due to invalid parameters, configuration states, or other factors with the 488.2 driver, this exception is thrown and the members are assigned with the available data about the error (i.e. error code, error count, and error message).
Every function call made will speak with the driver and the driver will work on the hardware layer to perform the operation. If the driver encounters an error, this exception should be thrown.