Dim dlg As new OpenFileDialog
dlg.Filter= "CSV文件|*.CSV" '设置筛选器
Tables("表A").StopRedraw
If dlg.ShowDialog = DialogResult.OK Then
Dim strs As String = FileSys.ReadAllText(dlg.FileName, encoding.default)
strs = strs.Replace(chr(13),"")
Dim rs() As String = strs.Split(chr(10))
For i As Integer = 0 To rs.Length - 1
rs(i) = System.Text.RegularExpressions.Regex.replace(rs(i), " +", chr(11))
Dim cs() As String = rs(i).Split(chr(11))
If cs.Length = 5 Then
If cs(0) <> "科目代码" Then
Dim dr As DataRow = DataTables("表A").Addnew()
dr("第一列") = cs(0)
dr("第二列") = cs(1)
dr("第三列") = cs(2)
dr("第四列") = cs(3)
End If
End If
Next
End If
Tables("表A").ResumeRedraw