public static MyCheckedListBox CreateDataSourceBoxes(Panel panel)
        {
            panel.Controls.Clear();
            var boxes = new MyCheckedListBox
            {
                DataSource    = DataCreator.CreateData(),
                DisplayMember = "Student",
                Dock          = DockStyle.Fill
            };

            panel.Controls.Add(boxes);
            return(boxes);
        }
        public static MyCheckedListBox CreateNewBoxes(Panel panel)
        {
            panel.Controls.Clear();
            var boxes = new MyCheckedListBox();

            for (int i = 0; i < 10; i++)
            {
                boxes.Items.Add($"A0{i}");
            }

            panel.Controls.Add(boxes);
            boxes.Dock = DockStyle.Fill;
            return(boxes);
        }
 public DataSourceByItem()
 {
     InitializeComponent();
     boxes = BoxesCreator.CreateDataSourceBoxes(panel2);
 }
 public ByIndex()
 {
     InitializeComponent();
     boxes = BoxesCreator.CreateNewBoxes(panel2);
 }