Do you know that popup/modal forms should never have ShowInTaskbar=True?

Last updated by Brook Jeynes [SSW] 8 months ago.See history

Question: What is wrong with this Picture?

ShowInTaskBar
Figure: Can you tell what is wrong with this Picture?

Answer: The 2 SSW SQL Auditor windows are bad, because one is just a modal form.

Note: We don't check for this in Code Auditor because making a form display as popup, is done at runtime via the ShowDialog method.

Dim frm as new frmCustomer frm.ShowDialog

Figure: Bad Code

If your form is designed to be used modally (and thus be called using ShowDialog) then ShowInTaskbar should be set to false in the form designer.

Dim frm as new frmCustomer frm.ShowInTaskBar = False frm.ShowDialog

Figure: Bad Code (because this should be set in the form designer)

Dim frm as new frmCustomer frm.ShowDialog

Figure: Good Code (ShowInTaskbar is set in the form's InitializeComponents method instead)

We open source. Powered by GitHub