How to Read & Write to Richtextbox in VB6

Written by keith perry
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Read & Write to Richtextbox in VB6
Use the RichTextBox to format text data for display. (Stockbyte/Stockbyte/Getty Images)

You can develop complex and sophisticated applications in Visual Basic 6, or VB6, with the aid of provided controls. The RichTextBox control is available to read, write and format text. Text can be displayed in the application or printed. You can use the control when requirements for text formatting exceed the capability of the standard text box control. A common use for this control is a notepad or text editor.

Skill level:
Moderate

Other People Are Reading

Instructions

  1. 1

    Select the "Start" icon located on the Windows menu bar and click "Microsoft Visual Basic 6.0" to start the Visual Basic integrated development environment.

  2. 2

    Click the "New" tab, select the "Standard.EXE" project type and click the "OK" button to continue.

  3. 3

    Select "Project" and then "Components" then check the box for "Microsoft Rich Textbox Control 6.0" and click the button labelled "OK."

  4. 4

    Double-click the "RichTextBox" icon to insert a RichTextBox control in the Window labelled "Form1."

  5. 5

    Double-click the "Button" icon to insert a button control labelled "Button1" in the Window labelled "Form1."

  6. 6

    Double-click the "Button" icon to insert a button control labelled "Button2" in the Window labelled "Form1."

  7. 7

    Double-click the "Button1" icon and insert the following code to write to the RichTextBox control:

    RichTextBox1.Text = "Test text"

  8. 8

    Double-click the "Button2" icon and insert the following code to read the text from the RichTextBox control:

    Msgbox(RichTextBox1.Text)

  9. 9

    Press the "F5" key to start the program in debug mode. Click "Button1" to write "test" in the RichTextBox. Click "Button2" to display a message box with the text "test" that was read from the RichTextBox.

Don't Miss

Filter:
  • All types
  • Articles
  • Slideshows
  • Videos
Sort:
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the eHow.co.uk site, you consent to the use of cookies. For more information, please see our Cookie policy.