2017-04-14 8 views

答えて

1

てみ使用

var count = Textbox.Lines.Length; 

More detail here

またはこの試してみてください。私は "Textbox.Lines.Length" を述べただけでなく

string[] tmpArray = textBox1.Lines; 
int count = tmpArray.Length; 
+0

は、Visual Studio 2010年にはもう有りませんだから私は試みた: – Goyal

+0

私はVS 2010を持っていないので、私はこれを確認することはできません。私の答えで新しいバージョンを試してください。 – FetFrumos

0
int first = 0; 
int last = 0; 
count=0;`enter code here` 
last = textBox.GetLastVisibleLineIndex(); 
count++; 
while (first <= last) 
{ 
String dummy = textBox.GetLineText(first); 
if (dummy.Contains("\n") || dummy.Contains("\r") || dummy.Contains("\r\n")) 
{ 
dummy = dummy.TrimEnd('\r', '\n'); 
count++; 
} 
first++; 
} 
関連する問題