Zebra Notes: Open, Save, Save As, and Format with a Rich Text Box

We have created an Application called MyNotes with a rich text box, a menu with standard items, and a toolstrip.

We are going to write code so that the richtext box fills the lower part of the form. We want to do this at form load and also whenever the form is resized. We will create a general sub and call it from both form load and form resize:

  1. Continue with the MyNotes Application.
  2. Drag the RichTextBox1 so that it is just under the toolstrip and at the left of the form.
  3. Write the code as shown below:
  4. Public Class Form1
    
        Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
            ResizeRichText()
        End Sub
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            ResizeRichText()
        End Sub
        Private Sub ResizeRichText()
            RichTextBox1.Width = Me.Width
            RichTextBox1.Height = Me.Height - RichTextBox1.Location.Y
        End Sub
    End Class 
  5. Click Save All SaveAllat this point and run the program to see what we have so far.

    NEXT: Save the contents of the RichText Box