Visual basic 2008/2010 - Working with richtextbox

이카루스 2014.01.14 21:11:56 *: 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)

End Sub
End Class