In this example we are finding minimum and maximum values in Listbox.
You can find more similar examples of programming for this programming language in the site.
Form Design:
Source Code:
1 2 3 4 5 6 7 8 9 10 | private void button1_Click(object sender, EventArgs e) { var numbers = listBox1.Items.Cast<object>().Select(obj => Convert.ToInt32(obj)); int min = numbers.Min(); int max = numbers.Max(); label1.Text = "Minimum Value : "+min.ToString(); label2.Text = "Maximum Value : " + max.ToString(); } |
Output: