WinForm 里面 怎么获取 TextBox的行数 和 字符串长度、  

解决方案 »

  1.   


    string[] lines = TextBox1.Lines;
    int lineCount = lines.Length;//行数
    int length = TextBox1.Text.Length;//字符串长度
      

  2.   

    textbox1.Lines.Length
    字符串长度是莫 一行的,还是所有的?
    textbox1.Text.Length
      

  3.   

    TextBox1.Lines.GetUpperBound(0) + 1  可取得文本行数
    TextBox1.TextLength    可取得文本长度
      

  4.   

    四楼的有误,TextBox1.Lines.GetUpperBound(0)便是行数,不需要+1,实际验证过
      

  5.   

    TextBox1.Lines.Length只是以回车换行分割后的数组元素个数,不是真正的行数。
    如果TextBox1自动换行,只记为一行。