Professional Documents
Culture Documents
Appending text
Open the toolbox yet again and this time drag onto the form a Textbox control. Set its Multiline
property to True and ScrollBars property to Vertical. Once you set Multiline to True youll see that
you can resize it vertically as well as horizontally on the form.
Go back to the buttons click event handler and add the following code:
textBox1.AppendText(String.Format("The time is {0:HH:mm:ss}",
DateTime.Now)+Environment.NewLine);
Now run the program and push the button a couple times in succession to see the results. Note how
we used the Environment classs NewLine method to get a reliable carriage return/line feed
sequence.