How to find out if there are equal numbers in the listbox? How should this be written in a loop?

do { a = v.Next(min, max + 1); listBox1.Items.Add(a); i++; a = b; a++; } while (i < n); if (a==aa) { s = "Одинаковые"; } else { s = "Разные"; } label5.Text = s; 
  • please give the definition of "numbers in the listbox" - Igor
  • Random numbers are entered into the listbox, I need to determine if there are numbers that repeat (for example, 11 repeated three times, etc.) - Anko
  • one
    "The main error of humanity - everyone thinks that he speaks clearly." Show the code. - Igor
  • do {a = v.Next (min, max + 1); listBox1.Items.Add (a); i ++; a = b; a ++; } while (i <n); {if (a == aa) {s = "Same"; } else {s = "Miscellaneous"; } label5.Text = s; - Anko Nov.
  • a = b, a ++ is wrong, I don’t know how to compare these numbers in a loop - Anko

1 answer 1

 label6.Text = listBox1.Items.Cast<string>().Distinct().Count() == listBox1.Items.Count ? "разные" : "одинаковые";