C# → Работа с ListBox & CheckListBox

Пример работы с ListBox и CheckListBox на языке программирование C#.

CheckListBox C#

 

Реализация:

public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            // получаем все цвета
            foreach (string s in Enum.GetNames(typeof(KnownColor)))
            {
                this.chkListPossibleValue.Items.Add(s);
            }
        }

        private void btnMove_Click(object sender, EventArgs e)
        {
            // есть выбранные элементы
            if (chkListPossibleValue.CheckedItems.Count > 0)
            {
                this.lstSelected.Items.Clear(); 
                // по все выбранным элементам
                foreach (string s in chkListPossibleValue.CheckedItems)
                {
                    lstSelected.Items.Add(s.ToString());
                }
                // снимаем выделение
                for (int i = 0; i < this.chkListPossibleValue.Items.Count; i++)
                    this.chkListPossibleValue.SetItemChecked(i, false);
            }
        }

        private void btnCleare_Click(object sender, EventArgs e)
        {
            this.lstSelected.Items.Clear();
        }
}

Related: louis vuitton made in usa under licensed fabric design, james liston pressly, best toy marketing campaigns, lucent health insurance claims mailing address, ann peacock partner, impulse response to step response calculator, nigel james reece james, arthur et lucie mouzin, tufting workshop las vegas, how do i cancel my urban air membership, frugal aesthetic merch, hombre film locations, do pepperoncinis need to be refrigerated, rolando boyce net worth, temporary electrical service requirements,