• 쇼핑몰
  • 커뮤니티
  • 북마크

vb.net




[기타] [vb.net] 텍스트파일(CSV) 파싱

하나를하더라도최선을
2019.09.19 20:48 1,153 0

본문



                    Dim fd As OpenFileDialog = New OpenFileDialog()
                    Dim strFileName As String
 
                    fd.Title = "추가할 파일을 선택해주세요."
                    fd.InitialDirectory = Application.StartupPath
                    fd.Filter = "TEXT Files (*.csv;*.txt)|*.csv;*.txt"
                    fd.FilterIndex = 1
                    fd.RestoreDirectory = True
                    Dim T As String
                    If fd.ShowDialog() = DialogResult.OK Then
                        strFileName = fd.FileName
                        Dim R As DataRow
                        Dim afile As FileIO.TextFieldParser = New FileIO.TextFieldParser(strFileName, System.Text.Encoding.Default)
                        Dim CurrentRecord As String() ' this array will hold each line of data
                        afile.TextFieldType = FileIO.FieldType.Delimited
                        afile.Delimiters = New String() {","}
                        afile.HasFieldsEnclosedInQuotes = True
                        Do While Not afile.EndOfData
                            CurrentRecord = afile.ReadFields
                            '// 이곳에 
                        Loop
                        afile.Close()
                        afile.Dispose()
                        DataGridViewAutoSizeColumn(MyDGV)
                    End If
 


댓글목록 0

등록된 댓글이 없습니다.