Save and Close does not fire Inspector.Close event

  • Thread starter Thread starter Roderic
  • Start date Start date
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.
 
It's normal. Use the Item_Close event to tell you when to kill the Inspector
in those cases.
 
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.
 
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
 
Back
Top