![]() ![]() | ||
Creating rich text boxes in code works much like creating standard text boxes in code (see "Creating Text Boxes in Code" earlier in this chapter). Here's an example—CreateRichTextBox on the CD-ROM—that creates a new rich text box when the user clicks a button:
Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click Dim RichTextBox1 As New RichTextBox() RichTextBox1.Size = New Size(150, 100) RichTextBox1.Location = New Point(70, 20) RichTextBox1.Text = "Hello from Visual Basic" Me.Controls.Add(RichTextBox1) End Sub
You can see the results of this code in Figure 5.13.
Related solution: |
Found on page: |
---|---|
196 |
![]() ![]() | ||