텍스트 파일 라인 단위로 입출력 연습
*
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

 

텍스트 파일 조작 연습

이 게시물을

댓글'1'

Public Class Form1


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim name As String
        Dim i As Double
        OpenFileDialog1.InitialDirectory = "c:\"
        OpenFileDialog1.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"
        OpenFileDialog1.FilterIndex = 2
        OpenFileDialog1.RestoreDirectory = True
        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))
                For i = 0 To 1000
                    Label1.Text = i
                Next
            End If

        Loop
        FileClose(3)
        Exit Sub
err:
        Exit Sub
    End Sub

End Class

이 댓글을

공유하기

SEARCH

MENU NAVIGATION