Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在一个窗口中显示循环中的所有值_C#_Winforms_Loops - Fatal编程技术网

C# 在一个窗口中显示循环中的所有值

C# 在一个窗口中显示循环中的所有值,c#,winforms,loops,C#,Winforms,Loops,我正在使用MessageBox.Show()显示循环中的数据,但它只显示1个值,我需要显示至少5个值 我试过: while (eN <= toE) { MessageBox.Show("EN: " + eN.ToString()); eN += step; } while(eN您可以使用不同的控件,比如多行文本框,或者在调用MessageBox之前连接所有字符串: StringBuilder sb = new StringBuilder(); while (eN <=

我正在使用
MessageBox.Show()显示循环中的数据,但它只显示1个值,我需要显示至少5个值

我试过:

while (eN <= toE) 
{
   MessageBox.Show("EN: " + eN.ToString());
   eN += step;
}

while(eN您可以使用不同的控件,比如多行文本框,或者在调用
MessageBox
之前连接所有字符串:

StringBuilder sb = new StringBuilder();
while (eN <= toE) 
{
   sb.AppendFormat("EN: {0}\n", eN);
   eN += step;
}
MessageBox.Show(sb.ToString());
StringBuilder sb=新建StringBuilder();

而(eN您可以使用不同的控件,比如多行文本框,或者在调用
MessageBox
之前连接所有字符串:

StringBuilder sb = new StringBuilder();
while (eN <= toE) 
{
   sb.AppendFormat("EN: {0}\n", eN);
   eN += step;
}
MessageBox.Show(sb.ToString());
StringBuilder sb=新建StringBuilder();

而(eN您可以将值连接到同一个字符串中,然后显示生成的连接字符串:

var stringBuilder = new StringBuilder();
while (eN <= toE)
{
    stringBuilder.AppendLine("EN: " + eN.ToString());
    eN += step;
}

MessageBox.Show(stringBuilder.ToString());
var stringBuilder=new stringBuilder();

而(eN您可以将值连接到同一个字符串中,然后显示生成的连接字符串:

var stringBuilder = new StringBuilder();
while (eN <= toE)
{
    stringBuilder.AppendLine("EN: " + eN.ToString());
    eN += step;
}

MessageBox.Show(stringBuilder.ToString());
var stringBuilder=new stringBuilder();

虽然(欢迎来到Stackoverflow!我缩短了你的问题,只包含你问题的绝对核心。我希望你不要介意。如果你觉得我删除了太多或不同意我的编辑太多,你可以通过问题下方的
编辑
按钮再次更改。欢迎来到Stackoverflow!我缩短了你的问题,只包含abs你的问题的绝对核心。我希望你不介意。如果你觉得我删除了太多或不同意我的编辑太多,你可以通过问题下方的
edit
按钮再次更改。