Public Class Form1
Dim WithEvents save As New SaveFileDialog
Dim WithEvents open As New OpenFileDialog
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
save.Title = "Save File"
save.Filter = "Txt|*.Txt"
save.ShowDialog()
End Sub
Private Sub save_FileOk(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles save.FileOk
RichTextBox1.SaveFile(save.FileName)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
open.Title = "Open file"
open.Filter = "Txt|*.Txt"
open.ShowDialog()
End Sub
Private Sub open_FileOk(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles open.FileOk
RichTextBox1.LoadFile(open.FileName)