以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 导入txt (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=126706) |
||||
-- 作者:huhu -- 发布时间:2018/10/26 18:12:00 -- 导入txt Dim dlg As new OpenFileDialog dlg.Filter = "文本文件|*.txt" Tables("SNMAC临时").StopRedraw If dlg.ShowDialog = DialogResult.OK Then Dim strs As String = FileSys.ReadAllText(dlg.FileName) 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 cs.Length = 3 Then Dim dr As DataRow = DataTables("SNMAC临时").Addnew() dr("dat") = cs(0) dr("sn") = cs(1) dr("mac") = cs(2) End If Next End If Tables("SNMAC临时").ResumeRedraw 这个txt每列是怎么分割的?好像不是tab。应该怎么处理?
|
||||
-- 作者:有点蓝 -- 发布时间:2018/10/26 20:34:00 -- Dim cs() As String = rs(i).replace(" ","$").replace("|","").replace("$$$$","|").Split("|") |