listBox Kullanımı

Örnek

listBox Kullanımı

private void textBoxAdet_TextChanged(object sender, EventArgs e)
{
    listBoxSag.Items.Clear();

    if (textBoxAdet.Text == "") return;

    int adet = Convert.ToInt32(textBoxAdet.Text);
    if (adet <= 0 || adet > listBoxSol.Items.Count) return;

    Random rnd = new Random();

    while (listBoxSag.Items.Count < adet)
    {
        int i = rnd.Next(listBoxSol.Items.Count);
        var item = listBoxSol.Items[i];

        if (!listBoxSag.Items.Contains(item))
            listBoxSag.Items.Add(item);
    }
}

 

Örnek

listBox Kullanımı

private void button1_Click(object sender, EventArgs e)
 {
     string ad = textBox1.Text;

     for (int i = 0; i < listBox1.Items.Count; i++)
     {
         if (listBox1.Items[i].ToString() == ad)
         {
             listBox2.Items.Add(ad);
             listBox1.Items.RemoveAt(i);
         }
     }
 }

 

Örnek

listBox Kullanımı

Yükleniyor...
Yükleniyor...