average apllication
  • i want to make that text box show average for input values which i put in it in combo box
  • 1 Comment sorted by
  • hi @hotnco_ol welcome to forum,
    you can use this below code

    comboBox1.DataSource = new List<decimal> { 10, 20, 30 };

                decimal SumUp = 0;

                for (int i = 0; i < comboBox1.Items.Count; i++)
                {
                    SumUp = SumUp + Convert.ToDecimal(comboBox1.Items[i]);
                }

                textBox1.Text = Convert.ToString(SumUp / Convert.ToDecimal(comboBox1.Items.Count));


Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Popular Posts of the Week

Top Posters Weekly

Optimum Creative