以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 关于提取字符串 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=105811) |
-- 作者:做自己 -- 发布时间:2017/8/26 15:23:00 -- 关于提取字符串 Dim Index1 As Integer Dim Index2 As Integer Dim strLuJing As String Dim strFileName As String Dim dlg As New OpenFileDialog \'定义一个新的OpenFileDialog dlg.Filter= "Excel文件|*.xls|Excel文件|*.xlsx|Word文件|*.doc|Word文件|*.docx" \'设置筛选器 If dlg.ShowDialog = DialogResult.Ok Then \'如果用户单击了确定按钮 Index1 = dlg.FileName.LastIndexOf("\\") strLuJing = dlg.FileName.SubString(0,Index1) strLuJing = strLuJing & "\\" For Each File As String In FileSys.GetFiles(strLuJing) Index2 = File.Length strFileName = File.SubString(Index1,Index2) MessageBox.Show(strLuJing) Next End If
|
-- 作者:有点蓝 -- 发布时间:2017/8/26 15:30:00 -- 看来你们总喜欢把简单的问题复杂化 Dim dlg As New OpenFileDialog \'定义一个新的OpenFileDialog dlg.Filter= "Excel文件|*.xls|Excel文件|*.xlsx|Word文件|*.doc|Word文件|*.docx" \'设置筛选器 If dlg.ShowDialog = DialogResult.Ok Then \'如果用户单击了确定按钮 For Each File As String In FileSys.GetFiles(FileSys.GetParentPath(dlg.FileName)) Dim strFileName = FileSys.GetName(File) Output.Show(strFileName) Next End If |