Serious problem with ShowDialog and ShowInTaskBar=False

  • Thread starter Thread starter Phil Jollans
  • Start date Start date
P

Phil Jollans

My product is an Add-In for Visual Studio .NET. Because the Add-In should
work with VS.NET 2002 and 2003, I am still compiling it with version 2002.

I have encountered a problem with the Form.ShowDialog() method, which only
occurs when running in VS.NET version 2003. However, I have no idea as to
whether the problem is specific to this constellation, in fact I doubt it.

Many of the forms in my project use COM controls. Following the advice in
Microsoft Knowledge Base Article - 312120,
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q312120
I have added the statement "Me.ShowInTaskbar = False" to the Form_Load
method of some forms.

The problem that occurs it that the method Form.ShowDialog() returns
immediately, without showing the form and returning the status Cancel!

Clearly this is intolerable and would appear to be a serious bug in the .NET
framework.

I have now, luckily, discovered that there is a connection between this
behaviour and the statement "Me.ShowInTaskbar = False" in the Form_Load
method. After commenting this statement out, the form is displayed correctly
(but with a fairly pointless button on the task bar).

As you can imagine, this is particularly annoying, since I added this
statement following instructions from Microsoft.

By the way, there is a newsgroup thread entitled "ShowDialog() returns
immediately with "Cancel"" describing a similar problem, indicating that it
is important to use the overloaded call Form.ShowDialog(IWin32Window). In my
case, this did not solve the problem.

Phil
 
Back
Top