VB application crashes after QueryCencelSelectionDelete

V

visio_newbie

Hi all,

My developing environment:
MS Win 2000 sp4
VB6 SP6
Visio 2003 standard SP2


In VB, the code for the event is as follows:


Private Function vdcFlow_QueryCancelSelectionDelete(ByVal selection As
Visio.IVSelection) As Boolean
Dim RetVal As VbMsgBoxResult


If selection.Item(1).Type = visTypeGroup Then
RetVal = MsgBox("Are you sure you want to delete step " &
selection.Item(1).Name & "?", vbQuestion + vbOKCancel)
If RetVal = vbOK Then
'Proceed to delete the step from table Step
If Not DeleteStep(Val(selection.Item(1).NameU)) Then
MsgBox "Failed to delete the step.", vbExclamation
End If
Else
vdcFlow_QueryCancelSelectionDelete = True
End If
End If
End Function


No matter which button (OK or Cancel) is clicked, the application
crashes with error "Visual Basic has encountered a problem and needs to

close. We are sorry for the inconvenience...." after executing End
Function.


Can anybody shed some light on what I am doing wrong?
Thanks in advance.


Chu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top