Program No 3_Rich Textbox
Program No 3_Rich Textbox
Aim:
Procedure:
Step 3: Drag and drop a RichTextBox, MenuStrip, and a ToolStrip onto the form.
Step 5:
Form Design
2. Add a MenuStrip to the form and configure the following menu items:
o File
▪ Open
▪ Save
▪ Exit
o Edit
▪ Clear
o Format
▪ Font
▪ Color
3. Link the menu items to the respective event handlers in the code above.
Features
Imports System.IO
Me.WindowState = FormWindowState.Maximized
End Sub
RichTextBox1.LoadFile(filePath, RichTextBoxStreamType.RichText)
Else
RichTextBox1.Text = File.ReadAllText(filePath)
End If
End If
End Sub
Else
File.WriteAllText(filePath, RichTextBox1.Text)
End If
End If
End Sub
RichTextBox1.SelectionFont = fontDialog.Font
End If
End Sub
RichTextBox1.SelectionColor = colorDialog.Color
End If
End Sub
RichTextBox1.Clear()
End Sub
' Exit Application
Me.Close()
End Sub
End Class
Result:
The program using Rich text box was successfully done using vb.net.