New form freezes on CommandBarButton.Click

T

tobias_ebsen

Hi

I'm creating a CommandBarButton for Outlook that creates a new form in
the Click event handler.

The problem is that when I show the form it seems to be frozen and
accepts no user input.

I ripped most of the code from an example found on MSDN:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnout2k2/html/odc_oladdinvbnet.asp

But somehow there is a difference that I can't spot. Have any of you
experienced anything like this?

My code is very straight forward:

------

Dim WithEvents _inspectors As Outlook.Inspectors
Dim WithEvents _commandButton As CommandBarButton

Private Sub OnConnection(...)
_inspectors = application.Inspectors
End Sub

Private Sub OnNewInspector(...) Handles _inspectors.NewInspector
If TypeOf inspector.CurrentItem Is Outlook.MailItem Then
Dim _commandBar As CommandBar =
inspector.CommandBars("Standard")
_commandButton =
CType(_commandBar.Controls.Add(MsoControlType.msoControlButton),
CommandBarButton)
_commandButton.Caption = "Test"
_commandButton.Style = MsoButtonStyle.msoButtonCaption
_commandButton.Visible = True
End If
End Sub

Public Sub OnButtonClick(...) Handles _commandButton.Click
Dim frmTest As New TestForm()
frmTest.Show()
System.Windows.Forms.Application.DoEvents()
End Sub
 
S

Sue Mosher [MVP-Outlook]

Creates a new form or creates a new item that uses a custom form? What kind
of form? Show the code you use to create and display the item.
 

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