我做了一个随机函数,想把生成的数组上的数都显示在textbox,请问怎么做,在线等

解决方案 »

  1.   

    将 TEXTBOX 的 MULTILINE 设为 TRUE
      

  2.   

    用一个循环啊。TextBox.text = ss[i].ToString + ",";
      

  3.   

    using System;
    using System.Text;
    using System.Windows.Forms;class Test : Form
    {
      Test()
      {
        StringBuilder sb  = new StringBuilder();
        Random        rnd = new Random();
        for (int i = 0; i < 10; i++)
        {
          sb.AppendFormat("{0}: {1}\r\n", i, rnd.Next());
        }    TextBox textBox    = new TextBox();
        textBox.Parent     = this;
        textBox.Width      = 200;
        textBox.Height     = 200;
        textBox.Multiline  = true;
        textBox.ScrollBars = ScrollBars.Vertical;
        textBox.Text       = sb.ToString();
      }  static void Main()
      {
        Application.Run(new Test());
      }
    }
      

  4.   

    using System;
    using System.Text;
    using System.Windows.Forms;class Test : Form
    {
      Test()
      {
        StringBuilder sb  = new StringBuilder();
        Random        rnd = new Random();
        for (int i = 0; i < 100; i++)
        {
          sb.AppendFormat("{0,3}: {1}{2}", i+1, rnd.NextDouble(), Environment.NewLine);
        }
        TextBox textBox         = new TextBox();
        textBox.Parent          = this;
        textBox.Width           = 200;
        textBox.Height          = 200;
        textBox.ReadOnly        = true;
        textBox.Multiline       = true;
        textBox.ScrollBars      = ScrollBars.Vertical;
        textBox.Text            = sb.ToString();
        textBox.SelectionLength = 0;
      }  static void Main()
      {
        Application.Run(new Test());
      }
    }
      

  5.   

    for (int i=0; i<n; i++)
    {
       TextBox.text += s[i].ToString() + ",";
    }