Save and Close does not fire Inspector.Close event

R

Roderic

Hi,

Closing contactitem window by clicking 'save and close' button seems to fire only Item.Write and
Item.Close events, but no Inspector.Close event.
Closing item using Alt+F4 combination ot just X in upper right corner raises Inspector.Close event.
Is it normal behaviour ?
I'm using OL2003 with SP1 and my addin s written in VB .NET.
 
K

Ken Slovak - [MVP - Outlook]

It's normal. Use the Item_Close event to tell you when to kill the Inspector
in those cases.
 
R

Roderic

Ken said:
It's normal. Use the Item_Close event to tell you when to kill the Inspector
in those cases.

But in Item_Close I don't know if user will not cancel closing item.
 
R

Roderic

Roderic said:
But in Item_Close I don't know if user will not cancel closing item.

Well, I think I found the solution - maybe it will be helpful for somebody:

Private Sub Close(ByRef Cancel As Boolean) Handles m_olContactItem.Close
Dim dlgres As DialogResult

If Not m_olContactItem.Saved Then
dlgres = MessageBox.Show("Do you want to save the item?", "Closing item",
MessageBoxButtons.YesNoCancel)
If dlgres = DialogResult.Yes Then
m_olContactItem.Close(Outlook.OlInspectorClose.olSave)
ElseIf dlgres = DialogResult.No Then
m_olInspector.Close(Outlook.OlInspectorClose.olDiscard)
Else
Cancel = True
End If
Else
m_olInspector_InspectorEvents_Event_Close()
End If

End Sub

m_olInspector_InspectorEvents_Event_Close() is Inspector.Close event handler
 

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