VB.NET
* Public Class Form1


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim name As String
OpenFileDialog1.Filter = ""
OpenFileDialog1.FilterIndex = 2
On Error GoTo err
OpenFileDialog1.ShowDialog()
OpenFileDialog1.FileName = OpenFileDialog1.FileName
FileOpen(3, OpenFileDialog1.FileName, OpenMode.Input)
Do While Not EOF(3)
name = LineInput(3)
If Len(Trim(name)) > 0 Then
ListBox1.Items.Add(Trim(name))
End If
Loop
FileClose(3)
Exit Sub
err:
Exit Sub
End Sub

End Class 

 

텍스트 파일 조작 연습