Export (0) Print
Expand All

Form.ShowInTaskbar Property

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

[Visual Basic]
Public Property ShowInTaskbar As Boolean
[C#]
public bool ShowInTaskbar {get; set;}
[C++]
public: __property bool get_ShowInTaskbar();
public: __property void set_ShowInTaskbar(bool);
[JScript]
public function get ShowInTaskbar() : Boolean;
public function set ShowInTaskbar(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 since you would need both the application's main window and the Find and Replace tool window displayed in order to process searches appropriately.

Example

[Visual Basic, C#, C++] The following 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 = new Form();
      myForm->Text = S"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();
   }

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Form Class | Form Members | System.Windows.Forms Namespace

Show:
© 2014 Microsoft