.NET Framework Class Library
Form.ShowInTaskbar Property

Gets or sets a value indicating whether the form is displayed in the Windows taskbar.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Syntax

Visual Basic (Declaration)
Public Property ShowInTaskbar As Boolean
Visual Basic (Usage)
Dim instance As Form
Dim value As Boolean

value = instance.ShowInTaskbar

instance.ShowInTaskbar = value
C#
public bool ShowInTaskbar { get; set; }
C++
public:
property bool ShowInTaskbar {
    bool get ();
    void set (bool value);
}
J#
/** @property */
public boolean get_ShowInTaskbar ()

/** @property */
public void set_ShowInTaskbar (boolean value)
JScript
public function get ShowInTaskbar () : boolean

public function set ShowInTaskbar (value : boolean)

Property Value

true to display the form in the Windows taskbar at run time; otherwise, false. The default is true.
Remarks

If a form is parented within another form, the parented form is not displayed in the Windows taskbar.

You can use this property to prevent users from selecting your form through the Windows taskbar. For example, if you display a Find and Replace tool window in your application, you might want to prevent that window from being selected through the Windows taskbar because you would need both the application's main window and the Find and Replace tool window displayed in order to process searches appropriately.

You will often wish to use this property when creating a form with the FixedToolWindow style. Setting the FixedToolWindow style does not alone guarantee that a window will not appear in the taskbar.

Example

The following code example demonstrates how to use the ShowInTaskbar property to make a dialog box that is not displayed in the Windows taskbar.

Visual Basic
Private Sub ShowInTaskBarEx()
    Dim myForm As New Form()
    myForm.Text = "My Form"
    myForm.SetBounds(10, 10, 200, 200)
    myForm.FormBorderStyle = FormBorderStyle.FixedDialog
    myForm.MinimizeBox = False
    myForm.MaximizeBox = False
    ' Do not allow form to be displayed in taskbar.
    myForm.ShowInTaskbar = False
    myForm.ShowDialog()
End Sub
C#
private void ShowInTaskBarEx()
{
    Form myForm = new Form();
    myForm.Text = "My Form";
    myForm.SetBounds(10,10,200,200);
    myForm.FormBorderStyle = FormBorderStyle.FixedDialog;
    myForm.MinimizeBox = false;
    myForm.MaximizeBox = false;
    // Do not allow form to be displayed in taskbar.
    myForm.ShowInTaskbar = false;
    myForm.ShowDialog();
}
C++
private:
   void ShowInTaskBarEx()
   {
      Form^ myForm = gcnew Form;
      myForm->Text = "My Form";
      myForm->SetBounds( 10, 10, 200, 200 );
      myForm->FormBorderStyle = ::FormBorderStyle::FixedDialog;
      myForm->MinimizeBox = false;
      myForm->MaximizeBox = false;

      // Do not allow form to be displayed in taskbar.
      myForm->ShowInTaskbar = false;
      myForm->ShowDialog();
   }
J#
private void ShowInTaskBarEx()
{
    Form myForm = new Form();
    myForm.set_Text("My Form");
    myForm.SetBounds(10, 10, 200, 200);
    myForm.set_FormBorderStyle(get_FormBorderStyle().FixedDialog);
    myForm.set_MinimizeBox(false);
    myForm.set_MaximizeBox(false);

    // Do not allow form to be displayed in taskbar.
    myForm.set_ShowInTaskbar(false);
    myForm.ShowDialog();
} //ShowInTaskBarEx
Platforms

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

Version Information

.NET Framework

Supported in: 2.0, 1.1, 1.0
See Also

Tags :


Page view tracker