EnableMethodErrors example for Visual Basic

Note: Also works with Access 95 and 97.

This example disables method errors temporarily so that it can give the user guidance about a particular error (an out-of-range shear angle using ILEADRasterProcess in this case).

' Declare local variables.
Dim ShearAngle, nRet, cMsg, answer
Dim RasterProc As New LEADRasterProcess

ShearAngle = 9000 ' This would be the user's input * 100
RasterProc.EnableMethodErrors = False
nRet = RasterProc.Shear(LEADRasterView1.Raster, ShearAngle, True, RGB(0, 0, 255))
If nRet = ERROR_INV_PARAMETER Then
   cMsg = "The angle cannot be more than 45 degrees"
   answer = MsgBox(cMsg, 0, "Error")
ElseIf nRet = 0 Then
   LEADRasterView1.ForceRepaint
Else
   MsgBox "Error: " & CStr(nRet)
End If