JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Creating Rich Text Boxes in Code

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"
End Sub

You can see the results of this code in Figure 5.13.

Figure 5.13: Creating a rich text box.

Related solution:

Found on page:

Adding and Removing Controls at Run Time


Previous Section Next Section

JavaScript Editor Free JavaScript Editor     JavaScript Editor