我想将13个文本框中的项添加到数组的13个元素中。一次全部使用按钮。我该怎么做呢?
List<double> scoreArray = new List<double>();
TextBox[] textBoxes = { week1Box, week2Box, week3Box, week4Box, week5Box, week6Box, week7Box, week8Box, week9Box, week10Box, week11Box, week12Box, week13Box };
for (int i = 0; i < textBoxes.Length; i++)
{
scoreArray.Add(Convert.ToDouble(textBoxes[i].Text));
}
答案 0 :(得分:0)
在按钮的Click事件上放置一个事件处理程序。
在处理程序中,提取文本框值并将其设置为数组的值。
轻松自在!