Gets or sets the lines of text in an text box control.
[Visual Basic] Public Property Lines As String () [C#] public string[] Lines {get; set;} [C++] public: __property String* get_Lines(); public: __property void set_Lines(String*[]); [JScript] public function get Lines() : String[]; public function set Lines(String[]);
An array of strings that contains the text in a text box control.
Each element in the array becomes a line of text in the text box control. If the Multiline property of the text box control is set to true and a newline character appears in the text, the text following the newline character is added to a new element in the array and displayed on a separate line.
The following example uses TextBox, a derived class. To extract all strings of text from the control and display them using the System.WinForms.Debug.Write method. This example assumes that an System.WinForms.Edit control has been created named Text1 and that it has been filled with lines of text.
[Visual Basic]
Public Sub DebugMyEditControl() 'Create a string array and store the contents of the Lines property. Dim tempArray() as String tempArray = Text1.Lines 'Loop through the array and send the contents of the array to debug window. For x = 0 to UBound(tempArray) Debug.WriteLine tempArray(x) Next End Sub
TextBoxBase Class | TextBoxBase Members | System.WinForms Namespace | Text