Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim fileR As String
Dim thefile As String
Dim results As String
Dim newfile As System.IO.FileStream
thefile = "c:\filetest.txt"
results = Dir$(thefile)
If results = "" Then
newfile = System.IO.File.Create("c:\filetest.txt")
MsgBox("파일이 생성 되었습니다")
Else
fileR = My.Computer.FileSystem.ReadAllText("c:\filetest.txt",
System.Text.Encoding.UTF8)
TextBox1.Text = fileR
End If
End Sub
Private Sub 불러오기ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 불러오기ToolStripMenuItem.Click
OpenFileDialog1.ShowDialog()
End Sub
Private Sub 종료ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 종료ToolStripMenuItem.Click
Me.Close()
End Sub
Private Sub 저장ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 저장ToolStripMenuItem.Click
Dim file As System.IO.StreamWriter
file = My.Computer.FileSystem.OpenTextFileWriter("c:\filetest.txt", False)
file.WriteLine(TextBox1.Text)
file.Close()
MsgBox("저장되었습니다")
End Sub
End Class
http://msdn.microsoft.com/ko-kr/library/zfk1t850(v=vs.85).aspx
이 댓글을