| | |
How to use wildcard for attachement file name?
Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Jan 2008
Posts: 35
Reputation:
Solved Threads: 0
How can I use wildcard/s for the attachment filename. Part of the filename changes but the characters 8 and 9 (counting from the left to right) always present and always either LK or KL. Currently files are PDF type, thus with extension PDF but might be different in the future (this is not important now). Please help. Thank you!
Here it is:
Here it is:
VB.NET Syntax (Toggle Plain Text)
Dim oAttch As Net.Mail.Attachment = New Net.Mail.Attachment("C:\test\102309LKO.pdf")
Last edited by leokuz; Oct 24th, 2009 at 12:17 am. Reason: typos
•
•
Join Date: Aug 2009
Posts: 94
Reputation:
Solved Threads: 6
0
#5 Oct 25th, 2009
VB.NET Syntax (Toggle Plain Text)
Dim oAttch As Net.Mail.Attachment = New Net.Mail.Attachment("C:\test\102309LKO.pdf").Contains("LK")
Last edited by yorro; Oct 25th, 2009 at 12:33 am.
•
•
Join Date: Jan 2008
Posts: 35
Reputation:
Solved Threads: 0
0
#6 Oct 25th, 2009
yorro, you have specified in this statement ("C:\test\102309LKO.pdf").Contains("LK") complete file name, but the problem is that I am dealing with files that while I know contain LK or KL, but I do not know what are the other six characters that preceed LK or KL (from left to right). The filenames are different everyday and the first six characters correspond to current date like you have suggested (e.g. if file for example created today, then it is 102409LK????.pdf, etc. ). So, how I address the mentioned uknown part of the filename?
Thank you for your time.
Thank you for your time.
•
•
Join Date: Aug 2009
Posts: 94
Reputation:
Solved Threads: 6
0
#7 Oct 25th, 2009
•
•
•
•
yorro, you have specified in this statement ("C:\test\102309LKO.pdf").Contains("LK") complete file name, but the problem is that I am dealing with files that while I know contain LK or KL, but I do not know what are the other six characters that preceed LK or KL (from left to right). The filenames are different everyday and the first six characters correspond to current date like you have suggested (e.g. if file for example created today, then it is 102409LK????.pdf, etc. ). So, how I address the mentioned uknown part of the filename?
Thank you for your time.
VB Syntax (Toggle Plain Text)
Filename As String = My.Computer.FileSystem.GetFiles("C:\test\",FileIO.SearchOption.SearchTopLevelOnly, "*.pdf*")
Then proceed to filter for each file name found using .Contains("LK")
You can look up the DIR function and FILEIO in MSDN.
I think searching for all files not only .pdf, you will use GETFILES function.
Last edited by yorro; Oct 25th, 2009 at 2:14 am.
•
•
Join Date: Aug 2009
Posts: 94
Reputation:
Solved Threads: 6
0
#9 Oct 25th, 2009
This would be your core code
You can mark thread as solved
vb Syntax (Toggle Plain Text)
' This would Save all Filenames in an array of string Dim FileName(0) As String Dim x As Integer = 0 For Each FoundFile As String In My.Computer.FileSystem.GetFiles("C:/Test/",FileIO.SearchOption.SearchTopLevelOnly, "*.pdf*") If FoundFile.Contains("LK") Then ' Or KL FileName(x) = FoundFile ' Saves filename to FileName String ReDim Preserve Filename(x+1) ' Adds another index to array x + = 1 End If Next
You can mark thread as solved
Last edited by yorro; Oct 25th, 2009 at 2:32 am.
![]() |
Similar Threads
- Line-by-line text file display in wxpython (Python)
- Apply code to 'x' button on form (Visual Basic 4 / 5 / 6)
- sort y but it not sort x (C++)
- Help in this assignment (C++)
- How to write the new line existing pdf file using php (PHP)
- wxPython file browser (Python)
- File Driectory Wildcard (Visual Basic 4 / 5 / 6)
- help for program involving switch loops and file (C++)
Other Threads in the VB.NET Forum
- Previous Thread: TCP Windows Mobile 6.1
- Next Thread: Adding Time to Splash Screen Help Please
| Thread Tools | Search this Thread |
.net 30minutes 2005 2008 access account arithmetic array arrays basic binary bing button buttons c# center check checkbox code combobox component connectionstring convert crystalreport data database databasesearch datagrid datagridview design dissertation dissertations dissertationthesis dropdownlist excel file-dialog folder ftp generatetags google gridview hardcopy image images inline insert intel internet listview mobile monitor ms net networking output passingparameters peertopeervideostreaming picturebox picturebox1 plugin port print printing problem problemwithinstallation project reports" save searchbox searchvb.net select serial server soap sql table tcp text textbox timer toolbox trim update updown user usercontrol vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web wpf






