I am developping an Outlook 2007 Add-In.
I have designed a Windows Form allowing to display operations the Add-In performs. The form is displayed modally.
In this form, I have 2 buttons, one to open an inspector on a mail item, the other to open an inspector on a contact item.
The "Show Mail" button behaves nicely, but the "Show Contact" always raises an exception saying that there is a dialog box open and I should close it before opening the contact inspector.
As the code for these 2 buttons is exactly the same, what would be the problem with the contact item inspector?
private void 开发者_开发问答btnShowMail_Click(object sender, EventArgs e)
{
logEvent.MailItem.Display(true);
}
private void btnShowContact_Click(object sender, EventArgs e)
{
logEvent.ContactItem.Display(true);
}
If the problem is that my Form is open, I don't see how to work around.
Thanks for your help!
I have the same problem, I found that method ContactItem.Display is in colision with your form (If your form is a modal dialog)
Workaround: If you are opening your form like:
myForm.ShowDialog();
change it to:
myForm.Show();
I know - thats not a good solution, but I didnt found better. :-(
精彩评论