Message 1 of 7

Not applicable
10-24-2020
09:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Im looking for a code in vb.net that could search the file (in my case for now .ipt), open it and do something like convert, add parameters etc. Usually the file names comes as list in excel.
This code can search but doesnt do much.
If System.IO.Directory.GetFiles("C:\Inventor Study\", "Test.ipt", IO.SearchOption.AllDirectories).Length > 0 Then MsgBox("Found!") Else MsgBox("Not found!") End If
This one got error: textbox_sa is not decleared.
Dim allFiles As IEnumerable(Of String) = System.IO.Directory.EnumerateFiles("C:\Inventor Study\", "Test.ipt", IO.SearchOption.AllDirectories) Dim filePaths As IList(Of String) = allFiles.Where(Function(f) f.IndexOf(TextBox_sa.Text, StringComparison.OrdinalIgnoreCase) <> -1).ToList() If filePaths.Count = 0 Then MessageBox.Show("File not found") Else For Each filePath As String In filePaths System.Diagnostics.Process.Start(filePath) Next End If
Thank you.
Solved! Go to Solution.