真的非常非常感谢有点甜的指教,通过下面的代码,可以读取指定目录下的文件和数据。
叩谢!!!
For Each MyFile As String In FileSys.GetFiles("E:\FoxTable Project\CMM测量时间收集程序\TXT File")
Tables("InforData").StopRedraw
Dim strs As String = FileSys.ReadAllText(Myfile)
strs = strs.Replace(vblf,"")
Dim rs() As String = strs.Split(vbcr)
For i As Integer = 0 To rs.Length - 1
Dim cs() As String = rs(i).Split(vbtab)
If i=1 Then
Dim dr As DataRow = DataTables("InforData").Addnew()
dr("OrderCMM") = cs(35) '----order
dr("Partnb") = cs(0) '----planid
dr("Operid") = cs(3) '----operid
dr("Date") = cs(4) '----date
dr("Time") = cs(5) '----time
Dim CMMInspector As String
CMMInspector=cs(1)
dr("Inspector") = right(left(CMMInspector,9),3)
dr("CostTime") = cs(56)
dr("FileName") = MyFile
Dim ifo As new FileInfo(MyFile)
dr("FileTime") = ifo.LastWriteTime
End If
Next
Tables("InforData").ResumeRedraw
Next