NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

CheckBox Class

Encapsulates a standard Windows check box.

Object
   MarshalByRefObject
      MarshalByRefComponent
         Control
            RichControl
               ButtonBase
                  CheckBox

[Visual Basic]
Public Class CheckBox
   Inherits ButtonBase
[C#]
public class CheckBox : ButtonBase
[C++]
public __gc class CheckBox : public ButtonBase
[JScript]
public class CheckBox extends ButtonBase

Remarks

Use a CheckBox to give the user an option such as true/false or yes/no. The check box control can display an System.WinForms.Image or text or both.

The Appearance property determines whether the check box supports an Image and appears like a button.

The ThreeState property determines whether the control supports two or three states. The third state is a dark grey check mark on a light grey background, commonly referred to as a shaded check box. Use the Checked property to get or set the value of a two-state check box control and the CheckState property to get or set the value of a three-state check box control.

CheckBox and RadioButton controls have a similar function: they allow the user to choose from a list of options. CheckBox controls let the user pick a combination of options. In contrast, RadioButton controls allow a user to choose from mutually exclusive options.

Requirements

Namespace: System.WinForms

Assembly: System.WinForms.dll

Example [Visual Basic]

The following example instantiates a CheckBox, gives it the appearance of a toggle button and sets AutoCheck to false.

[Visual Basic]

' Instantiate a CheckBox.   
Private CheckBox1 As System.WinForms.CheckBox
Private Sub MySub()
   ' Initialize a new CheckBox. 
   Form1.CheckBox1 = New System.WinForms.CheckBox
   
   ' Make the checkbox control appear as a toggle button.
   CheckBox1.Appearance = Appearance.Button

   ' Turn off the update of the display on the click of the control.
   CheckBox1.AutoCheck = False

   ' Add the check box control to the form.
   Form1.Controls.Add(CheckBox1)
End Sub

See Also

CheckBox Members | System.WinForms Namespace | ButtonBase