problem processing COMException in VB6

Mark Hammond MarkH at ActiveState.com
Wed Oct 3 21:37:49 EDT 2001


Jim Kerr wrote:
...

>  raise COMException(desc="No measurement defined on channel %d" %
> channelNum, scode=winerror.DISP_E_BADINDEX)
> 
> and the VB client catches the exception with
> 
>     MsgBox Err.Number & vbCrLf & Err.Description, vbCritical, "Server
> Error"
> 
> then the message box displays the text "Subscript out of range"
> instead of "No measurement defined on channel 3".


It is likely that VB is treating DISP_E_BADINDEX specially.  Try using 
DISP_E_EXCEPTION.

Mark.




More information about the Python-list mailing list