Tôi làm cách nào để thêm một dòng văn bản vào một số multi-lineTextBox
?Làm cách nào để thêm một dòng vào một Hộp văn bản nhiều dòng?
ví dụ: mã giả;
textBox1.Clear();
textBox1.Lines.Add("1000+");
textBox1.Lines.Add("750-999");
textBox1.Lines.Add("400-749");
...snip...
textBox1.Lines.Add("40-59");
hoặc
textBox1.Lines.Append("brown");
textBox1.Lines.Append("brwn");
textBox1.Lines.Append("brn");
textBox1.Lines.Append("brow");
textBox1.Lines.Append("br");
textBox1.Lines.Append("brw");
textBox1.Lines.Append("brwm");
textBox1.Lines.Append("bron");
textBox1.Lines.Append("bwn");
textBox1.Lines.Append("brnw");
textBox1.Lines.Append("bren");
textBox1.Lines.Append("broe");
textBox1.Lines.Append("bewn");
Các phương pháp duy nhất mà TextBox.Lines cụ (mà tôi có thể nhìn thấy) là:
- Clone
- CopyTo
- Equals
- GetType
- GetHashCode
- GetEnumerator
- Initialize
- GetLowerBound
- GetUpperBound
- getLength
- GetLongLength
- GetValue
- SetValue
- ToString
bạn không thể sử dụng phụ thêm (Enviroment.NewLine) ?? – jclozano
TextBox.Lines là một đại diện chỉ đọc của văn bản. Vui lòng tham khảo http://msdn.microsoft.com/en-us/library/system.windows.forms.textboxbase.lines.aspx. – Casperah
@Casperah Ohhh, giúp giải thích lý do tại sao nó không thể được sử dụng để làm những gì tôi muốn - Microsoft là (một cách không quá tinh tế) ngăn cản bạn thực hiện một đường dẫn mã chậm hơn –