Voss
Voss

Reputation: 1

VB.net - Form won't show

My problem concern an application which is currently running in production since 6 months. But last week, one user reported me this :

Above all, this application is a complement to Outlook, which allows users to create, edit and delete tickets through a new tab in the ribbon.

When this user clicks on a button (Create), a window is supposed to appear. In my code, this window is used in two places, one to create the ticket and the other to edit the ticket. When the user wants to edit a ticket, this window appears without problem. But just to create, he won't appear.

I call the window like this for creating :

Dim oForm1 As Create_form
oForm1 = New Create_form(Nothing)
oForm1.Show()

And like this for editing :

Dim oForm1 As Create_form
oForm1 = New Create_form(ticket)
oForm1.Show()

And here is the constructor :

Public Sub New(ticket As Ticket)
    InitializeComponent()
    MaximizeBox = False
    actualTicket = ticket

    Init_List()
    Init_Fields()
End Sub

I have looked for solutions on the Internet, but it seems I am the only one with this problem. This code worked for this person until last week without any change. One possibility I thought about is the Microsoft redistributable and the Outlook version (Developed and tested on Outlook 2016, used on Outlook 2013...).

Any ideas ?

Thanks for your help !

Ps : Please excuse my more than average English

Upvotes: 0

Views: 484

Answers (2)

Voss
Voss

Reputation: 1

Finally I found the solution, for the creation of one ticket, I'm using the system date with a specific function. But, the user who have the problem change the default setting in the Windows configuration. So the form could not be displayed due to an unmanaged exception (English date when the software expect French date).

Upvotes: 0

Eugene Astafiev
Eugene Astafiev

Reputation: 49395

First of all, make sure your add-in is enabled and running in Outlook.


Microsoft Office applications can disable VSTO Add-ins that behave unexpectedly. If an application does not load your VSTO Add-in, the application might have hard disabled or soft disabled your VSTO Add-in.

Hard disabling can occur when a VSTO Add-in causes the application to close unexpectedly. It might also occur on your development computer if you stop the debugger while the Startup event handler in your VSTO Add-in is executing.

Soft disabling can occur when a VSTO Add-in produces an error that does not cause the application to unexpectedly close. For example, an application might soft disable a VSTO Add-in if it throws an unhandled exception while the Startup event handler is executing.

When you re-enable a soft-disabled VSTO Add-in, the application immediately attempts to load the VSTO Add-in. If the problem that initially caused the application to soft disable the VSTO Add-in has not been fixed, the application will soft disable the VSTO Add-in again. Read more about that in the How to: Re-enable a VSTO Add-in that has been disabled article.


Most probably the form is displayed behind the Outlook window. To show a form on top of the Outlook window you need to specify the parent window handle. In .net based applications or add-ins you typically use Windows forms classes to show a window. The Show and ShowDialog methods of the System.Windows.Forms.Form class accept an instance of the IWin32Window interface which stands for the parent window handle. See How to set the Window.Owner to Outlook window for more information.

Upvotes: 1

Related Questions