Back to Devexpress

CheckedListBoxControl() Constructor

windowsforms-devexpress-dot-xtraeditors-dot-checkedlistboxcontrol-dot-ctor-c7c9e00b.md

latest4.0 KB
Original Source

CheckedListBoxControl() Constructor

Creates a new CheckedListBoxControl object with default settings.

Namespace : DevExpress.XtraEditors

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public CheckedListBoxControl()
vb
Public Sub New

Remarks

Use this constructor to create and initialize a new CheckedListBoxControl class instance. The constructor initializes the created checked list box control with default settings.

Example

The following sample code demonstrates how to create and populate a CheckedListBoxControl at runtime. The image below illustrates the control’s look & feel after sample code execution.

csharp
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
// ...
CheckedListBoxItem[] items = {
                                 new CheckedListBoxItem("January", false),
                                 new CheckedListBoxItem("February", false),
                                 new CheckedListBoxItem("March", true),
                                 new CheckedListBoxItem("April", false),
                                 new CheckedListBoxItem("May", false),
                                 new CheckedListBoxItem("June", true),
                                 new CheckedListBoxItem("July", true),
                                 new CheckedListBoxItem("August", false),
                                 new CheckedListBoxItem("September", false),
                                 new CheckedListBoxItem("October", false),
                                 new CheckedListBoxItem("November", false),
                                 new CheckedListBoxItem("December", false)
                              };
private void CreateCheckedListBoxControl(CheckedListBoxItem[] items){
   CheckedListBoxControl checkedListBoxControl = new CheckedListBoxControl();
   Controls.Add(checkedListBoxControl);
   checkedListBoxControl.Left = 20;
   checkedListBoxControl.Top = 20;
   checkedListBoxControl.Width = 200;
   checkedListBoxControl.Height = 150;
   checkedListBoxControl.Items.AddRange(items);
}
// ...
CreateCheckedListBoxControl(items);
vb
Imports DevExpress.XtraEditors
Imports DevExpress.XtraEditors.Controls
' ...
Dim items() As CheckedListBoxItem = { _
  New CheckedListBoxItem("January", False), New CheckedListBoxItem("February", False), _
  New CheckedListBoxItem("March", True), New CheckedListBoxItem("April", False), _
  New CheckedListBoxItem("May", False), New CheckedListBoxItem("June", True), _
  New CheckedListBoxItem("July", True), New CheckedListBoxItem("August", False), _
  New CheckedListBoxItem("September", False), New CheckedListBoxItem("October", False), _
  New CheckedListBoxItem("November", False), New CheckedListBoxItem("December", False)}
Private Sub CreateCheckedListBoxControl(ByVal items() As CheckedListBoxItem)
   Dim checkedListBoxControl As New CheckedListBoxControl()
   Controls.Add(checkedListBoxControl)
   checkedListBoxControl.Left = 20
   checkedListBoxControl.Top = 20
   checkedListBoxControl.Width = 200
   checkedListBoxControl.Height = 150
   checkedListBoxControl.Items.AddRange(items)
End Sub
' ...
CreateCheckedListBoxControl(items)

See Also

CheckedListBoxControl Class

CheckedListBoxControl Members

DevExpress.XtraEditors Namespace