|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
File operation with user-set wildcardsthis example: If TextBox1.Text = "" Then Else For Each foundFile As String In My.Computer.FileSystem.GetFiles(curdir & "\_res_original", _ FileIO.SearchOption.SearchAllSubDirectories, TextBox1.Text) My.Computer.FileSystem.DeleteFile(foundFile) Next End If ------------ TextBox1.Text should look like <"*.exe", "*.txt", "*.ini"> It works with one extension but if I specify many of them, vb gives an error that there is an illegal character. I suppose it handles the commas not correctly. Thanks for any help On Thu, 24 Aug 2006 06:56:01 -0700, kenny <ke***@discussions.microsoft.com> wrote:
Show quoteHide quote >I want to delete files but I also want to set the wildcards manually. Look at The argument for wildcard parameters is a string array:>this example: > > If TextBox1.Text = "" Then > Else > For Each foundFile As String In >My.Computer.FileSystem.GetFiles(curdir & "\_res_original", _ > FileIO.SearchOption.SearchAllSubDirectories, TextBox1.Text) > My.Computer.FileSystem.DeleteFile(foundFile) > Next > End If > >------------ > >TextBox1.Text should look like <"*.exe", "*.txt", "*.ini"> >It works with one extension but if I specify many of them, vb gives an error >that there is an illegal character. I suppose it handles the commas not >correctly. > >Thanks for any help Dim FileTypes As String() = {"*.exe", "*.txt", "*.ini"} Change ....SearchAllSubDirectories, TextBox1.Text to .....SearchAllSubDirectories, FileTypes Gene Thanks.
But how can I convert the string from the textbox into a string array so it will be recognized as separated wildcards? "gene kelley" schrieb: Show quoteHide quote > > > The argument for wildcard parameters is a string array: > Dim FileTypes As String() = {"*.exe", "*.txt", "*.ini"} > > Change ....SearchAllSubDirectories, TextBox1.Text > to > .....SearchAllSubDirectories, FileTypes > > > Gene > This returns a string array:
TextBox1.Text.split(","c) hope this helps Greetz, Peter -- Show quoteHide quoteProgramming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. (Rich Cook) "kenny" <ke***@discussions.microsoft.com> schreef in bericht news:7C06D9A4-F73D-4BE0-8E0E-5CFF7A54C875@microsoft.com... > Thanks. > But how can I convert the string from the textbox into a string array so it > will be recognized as separated wildcards? > > "gene kelley" schrieb: > > > > > > The argument for wildcard parameters is a string array: > > Dim FileTypes As String() = {"*.exe", "*.txt", "*.ini"} > > > > Change ....SearchAllSubDirectories, TextBox1.Text > > to > > .....SearchAllSubDirectories, FileTypes > > > > > > Gene > > Alright, it works.
I forgot to write the c, that was the problem. Thank you both for helping me! "Peter Proost" schrieb: Show quoteHide quote > This returns a string array: > > TextBox1.Text.split(","c) > > hope this helps > > Greetz, Peter > > > > > -- > Programming today is a race between software engineers striving to build > bigger and better idiot-proof programs, and the Universe trying to produce > bigger and better idiots. So far, the Universe is winning. (Rich Cook) > > "kenny" <ke***@discussions.microsoft.com> schreef in bericht > news:7C06D9A4-F73D-4BE0-8E0E-5CFF7A54C875@microsoft.com... > > Thanks. > > But how can I convert the string from the textbox into a string array so > it > > will be recognized as separated wildcards? > > > > "gene kelley" schrieb: > > > > > > > > > The argument for wildcard parameters is a string array: > > > Dim FileTypes As String() = {"*.exe", "*.txt", "*.ini"} > > > > > > Change ....SearchAllSubDirectories, TextBox1.Text > > > to > > > .....SearchAllSubDirectories, FileTypes > > > > > > > > > Gene > > > > > > You're welcome
Greetz, Peter -- Show quoteHide quoteProgramming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. (Rich Cook) "kenny" <ke***@discussions.microsoft.com> schreef in bericht news:8CE11163-343F-4604-8E43-A8B884B2401D@microsoft.com... > Alright, it works. > I forgot to write the c, that was the problem. > Thank you both for helping me! > > "Peter Proost" schrieb: > > > This returns a string array: > > > > TextBox1.Text.split(","c) > > > > hope this helps > > > > Greetz, Peter > > > > > > > > > > -- > > Programming today is a race between software engineers striving to build > > bigger and better idiot-proof programs, and the Universe trying to produce > > bigger and better idiots. So far, the Universe is winning. (Rich Cook) > > > > "kenny" <ke***@discussions.microsoft.com> schreef in bericht > > news:7C06D9A4-F73D-4BE0-8E0E-5CFF7A54C875@microsoft.com... > > > Thanks. > > > But how can I convert the string from the textbox into a string array so > > it > > > will be recognized as separated wildcards? > > > > > > "gene kelley" schrieb: > > > > > > > > > > > > The argument for wildcard parameters is a string array: > > > > Dim FileTypes As String() = {"*.exe", "*.txt", "*.ini"} > > > > > > > > Change ....SearchAllSubDirectories, TextBox1.Text > > > > to > > > > .....SearchAllSubDirectories, FileTypes > > > > > > > > > > > > Gene > > > > > > > > > >
Coding service dependencies
streaming the output of a batch file to a text box? Drag and Drop from Outlook to Vb.net RichTextBox not able to run the Process Problem re-enabling menu item Where is the ENTIRE list of compile time error messages/numbers stored in vb/visual studi Copying my file to another location on the hard disk Compile VB6 Code Runtime How to put a binary file(let say PDF) on memory for reading? Listbox assigning default |
|||||||||||||||||||||||