简体   繁体   English

VB.net-表格不会显示

[英]VB.net - Form won't show

My problem concern an application which is currently running in production since 6 months. 我的问题涉及一个自6个月以来一直在生产中运行的应用程序。 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. 最重要的是,此应用程序是对Outlook的补充,它允许用户通过功能区中的新选项卡创建,编辑和删除票证。

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...). 我考虑过的一种可能性是Microsoft可再发行版和Outlook版本(在Outlook 2016上开发和测试,在Outlook 2013上使用...)。

Any ideas ? 有任何想法吗 ?

Thanks for your help ! 谢谢你的帮助 !

Ps : Please excuse my more than average English 附言:请原谅我的英语水平超过平均水平

First of all, make sure your add-in is enabled and running in Outlook. 首先,请确保您的加载项已启用并在Outlook中运行。


Microsoft Office applications can disable VSTO Add-ins that behave unexpectedly. Microsoft Office应用程序可以禁用行为异常的VSTO加载项。 If an application does not load your VSTO Add-in, the application might have hard disabled or soft disabled your VSTO Add-in. 如果应用程序未加载VSTO加载项,则该应用程序可能已硬禁用或软禁用了VSTO加载项。

Hard disabling can occur when a VSTO Add-in causes the application to close unexpectedly. 当VSTO加载项导致应用程序意外关闭时,可能会发生硬禁用。 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. 如果在执行VSTO加载项中的Startup事件处理程序时停止调试器,则它也可能在开发计算机上发生。

Soft disabling can occur when a VSTO Add-in produces an error that does not cause the application to unexpectedly close. 当VSTO加载项产生不会导致应用程序意外关闭的错误时,可能会发生软禁用。 For example, an application might soft disable a VSTO Add-in if it throws an unhandled exception while the Startup event handler is executing. 例如,如果在启动事件处理程序执行期间引发未处理的异常,则应用程序可能会软禁用VSTO加载项。

When you re-enable a soft-disabled VSTO Add-in, the application immediately attempts to load the VSTO Add-in. 当您重新启用软禁用的VSTO加载项时,应用程序将立即尝试加载VSTO加载项。 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. 如果最初导致应用程序软禁用VSTO加载项的问题尚未解决,则应用程序将再次软禁用VSTO加载项。 Read more about that in the How to: Re-enable a VSTO Add-in that has been disabled article. 在“ 如何:重新启用已禁用的VSTO加载项”一文中了解有关此内容的更多信息。


Most probably the form is displayed behind the Outlook window. 该窗体很可能显示在Outlook窗口的后面。 To show a form on top of the Outlook window you need to specify the parent window handle. 要在Outlook窗口顶部显示表单,您需要指定父窗口句柄。 In .net based applications or add-ins you typically use Windows forms classes to show a window. 在基于.net的应用程序或加载项中,通常使用Windows窗体类显示一个窗口。 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. System.Windows.Forms.Form类的ShowShowDialog方法接受IWin32Window接口的实例,该实例代表父窗口句柄。 See How to set the Window.Owner to Outlook window for more information. 有关更多信息,请参见如何将Window.Owner设置为Outlook窗口

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. 但是,有问题的用户会更改Windows配置中的默认设置。 So the form could not be displayed due to an unmanaged exception (English date when the software expect French date). 因此,由于存在非托管异常(软件预期的法语日期为英文日期),因此无法显示该表单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM