Cancel Send not cancelling

J

James Winton

Below is my vb.net code for cancelling the send event if a user property is
empty. The code processes when the Entity value is empty. I have stepped
through the code and can see it set cancel = true. the msgbox pops-up but
it still sends the message. Any ideas.

Private Sub m_olMailItem_Send(ByRef Cancel As Boolean) Handles
m_olMailItem.ItemEvents_Event_Send

Try

If Len(Trim(CType(m_olMailItem.UserProperties("Entity").Value, String))) = 0
Then

Cancel = True

MsgBox("Client No. must be entered before mail can be sent.",
MsgBoxStyle.Information)

End If

Catch ex As System.Exception

MsgBox(ex.Message)

End Try

End Sub
 

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