我有以下代码,如何从列表框中的项目中获取值并让我的程序找到值的平均值、最高和最低值。我目前有以下文本框(averageTextbox、highestTextbox、lowestTextbox),我希望将值相应地显示到文本框中。提前致谢!
private void readButton_Click(object sender, EventArgs e)
{
int counter = 0;
string line;
System.IO.StreamReader file = new System.IO.StreamReader(
@"C:\Users\Harra\Documents\Visual Studio 2017\Projects\File Reader\Sales.txt");
double dblAdd = 0;
while ((line = file.ReadLine()) != null)
{
displayListBox.Items.Add(line);
dblAdd += Convert.ToDouble(line);
counter++;
}
totalTextBox.Text = string.Format("{0:F}", dblAdd);
}