突然发晕想不起来了!
比如用控制台可以输出一条
Console.WriteLine("客户关闭连接:当前剩{0} 个连接数", connections);
我想让一个textbox显示出同样的语句,应该是什么格式呢?

解决方案 »

  1.   

    textbox.Text = string.Format("客户关闭连接:当前剩{0} 个连接数", connections);
      

  2.   


    textbox1.text = "客户关闭连接:当前剩"+connections+"个连接数";
    ??
      

  3.   

    textbox.Text = string.Format("客户关闭连接:当前剩{0} 个连接数", connections);
      

  4.   

    text只是一个字符串,楼上的2种豆可以
      

  5.   

    textbox.Text = String.Format("客户关闭连接:当前剩{0} 个连接数", connections);
      

  6.   

    textbox.Text 为 string 类型
    所以用string.Format("**{0}{1}",argv1,argv2);
      

  7.   

    LZ要是习惯用F1查MSDN,这个问题完全不用再网上问的,呵呵
      

  8.   

    textbox.text="客户关闭连接:当前剩"+connections+"个连接数"
    这个不行么?
      

  9.   

    textbox显示字符串,textbox1.text = "客户关闭连接:当前剩"+connections+"个连接数";
    怎么不用label显示?
    如果只是想显示信息,用label比较合适
    textbox一般用在修改数据时
      

  10.   

    如果只是想输出这句话,用lable吧,毕竟textbox是可修改的。
      

  11.   

    lable.txt = "客户关闭连接:当前剩{0} 个连接数";
      

  12.   

    textbox1.Text = string.Format("客户关闭连接:当前剩{0} 个连接数", connections);
      

  13.   


    textbox.Text = String.Format("客户关闭连接:当前剩{0} 个连接数", connections);
    其实如果只是需要显示的话,在TD或者LABEL中都是可以实现的,实现方法与之上大同小异```
      

  14.   

    textbox.Text = "客户关闭连接:当前剩"+connections+"个连接数";
      

  15.   


    textbox.Text = "客户关闭连接:当前剩" + connections + "个连接数";