Neal, One thing I have done in the past is to pre-sort the data in a dataview, prior to adding it to the listbox. Just make sure the listbox is not set to autosort and the items will remain in the order that you add them.
Darrell
I know you'll catch this, but you may need to provide error handling in the event that a file doesn't have an extension. Not sure what happens one of these two I suspect:
1) extension is an empty string which will probably cause a runtime error or
2) you end up matching for "|" which will...
If ValidExtensions.IndexOf(fil.Extension) > -1 Then
changes to
If ValidExtensions.IndexOf(fil.Extension & "|") > -1 Then
Notice that in the ValidExtensions string each file type was delimited by a "|" character. Adding this character to the file extension will allow absolute matches. For...
Neal,
Apply a delimiter character "|" to the end of the extension. That should take care of that issue. Do you have it displaying the .aspx files now? I modified the imagebrowser for bv and it displays those files just fine on my test box.
Darrell
another thought
Neal,
I afraid that I'm not going to be much help in the permissions category. I too new to the asp and IIS side of things. How are you connecting? I usually try to connect using file shareing and am requested to provide a user id and password to gain access to list the files...
A slightly faster option, probably. Would be to include the extensions you do not want to copy in the validextensions string and use = -1 to determine which files not to include. Reverse logic, so to speak.
Thanks, but this is better.
For Each fil In dir.GetFiles()
If ValidExtensions.IndexOf(fil.Extension) > -1 Then
Debug.WriteLine(fil.FullName)
End If
Next
My last attempt. I promise.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim dir As New DirectoryInfo("C:\inetpub\wwwroot\bvc29")
Dim fil As FileInfo
Dim ValidExtensions As String =...
Neal,
Not sure if this is any faster, but it might be worth a shot with a stop watch. I expect that using this method part of the overhead may be performed at the OS level rather then the .net runtime.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles...
Neal,
I've seen several sample programs that will read a directory listing into a dataset. This link (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndive/html/data09132001.asp) contains an example. What if you read the directory list into a dataset and applied a filter...
Neal,
Based on my limited experience with the RegEx operations the amount if time saved DataSet vs Hashtable will (probably) not greatly effect the performance of the lookup function overall.
As an afterthought: for ranges you might try seperating the source string from the parameter value...
Neal,
The String Like comparison using wildcards will work for most of the examples you gave except for the range example
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vaoprlike.asp
and you will hate me for this one, but is the RegEx reference from MSDN...
Neal,
Do you see yourself as the developer building the table or an end user? If you are building the table then one of the database fields could contiain regular expression format strings. It wouldn't be fast but you could loop through each of the items in the config table doing a compare to...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.