Requires Free Membership to View
When you register, you'll begin receiving targeted emails from my team of award-winning writers. Our goal is to provide a unique online resource for developers, architects and development managers tasked with building and maintaining enterprise applications using Visual Basic, C# and the Microsoft .NET platform.
Hannah Smalltree, Editorial DirectorLine 1 xxxxxx Line 2 yyyyyy Line 3 mmmmmm and so on?
Also, I notice that the rich text box has a +Lines: String[]Array. Can this be used to write text from variables?
Here are two button handlers that show both ways and produce the same text in the RichTextBox control:
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button1.Click
RichTextBox1.Text = "Line 1 xxxxxx" + vbCrLf
RichTextBox1.Text += "Line 2 yyyyyy" + vbCrLf
RichTextBox1.Text += "Line 3 mmmmmm and so on?" + vbCrLf
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button2.Click
Dim myLines(3) As String
myLines(0) = "[using Lines] Line 1 xxxxxx"
myLines(1) = "[using Lines] Line 2 yyyyyy"
myLines(2) = "[using Lines] Line 3 mmmmmm and so on?"
RichTextBox1.Lines = myLines
End Sub
This was first published in June 2004