insert letter after letter within a short time vb6
Author |
Message |
Catharinu #1 / 14
|
 insert letter after letter within a short time vb6
Hello my friends I want to search a directory very quick. This directory conists of 10000 subdirectories with several almost the same names, like DEMO0001 to DEMO9000 When I press the D, the program immediately start to search the subidrectories which name starts with a D. and after typing the E, the program starts again searching for subdirectories, which name starts with DE, etc. This takes a little too much time, so I guess it would be better to first create a searchstring very quickly and start the seach after I wait 0.5 second. Any idea? thanks Catharinus
|
Fri, 05 Jul 2013 06:13:44 GMT |
|
 |
Hennin #2 / 14
|
 insert letter after letter within a short time vb6
Quote: > Hello my friends > I want to search a directory very quick. This directory conists of > 10000 subdirectories with several almost the same names, like DEMO0001 > to DEMO9000 When I press the D, the program immediately start to > search the subidrectories which name starts with a D. and after typing > the E, the program starts again searching for subdirectories, which > name starts with DE, etc. This takes a little too much time, so I > guess it would be better to first create a searchstring very quickly > and start the seach after I wait 0.5 second. > Any idea? > thanks > Catharinus
Or you could wait for the <Enter> key. /Henning
|
Fri, 05 Jul 2013 07:56:49 GMT |
|
 |
Catharinu #3 / 14
|
 insert letter after letter within a short time vb6
Quote:
> > Hello my friends > > I want to search a directory very quick. This directory conists of > > 10000 subdirectories with several almost the same names, like DEMO0001 > > to DEMO9000 When I press the D, the program immediately start to > > search the subidrectories which name starts with a D. and after typing > > the E, the program starts again searching for subdirectories, which > > name starts with DE, etc. This takes a little too much time, so I > > guess it would be better to first create a searchstring very quickly > > and start the seach after I wait 0.5 second. > > Any idea? > > thanks > > Catharinus > Or you could wait for the <Enter> key. > /Henning
Yes, I thoiught about that, but.. Any idea?
|
Fri, 05 Jul 2013 16:15:33 GMT |
|
 |
argus #4 / 14
|
 insert letter after letter within a short time vb6
Quote: > Hello my friends > I want to search a directory very quick. This directory conists of > 10000 subdirectories with several almost the same names, like DEMO0001 > to DEMO9000 When I press the D, the program immediately start to > search the subidrectories which name starts with a D. and after typing > the E, the program starts again searching for subdirectories, which > name starts with DE, etc. This takes a little too much time, so I > guess it would be better to first create a searchstring very quickly > and start the seach after I wait 0.5 second. > Any idea? > thanks > Catharinus
One of a hundred ways to do what you want - First letter: scan subdirectories and add to an array (or listbox, whatever). The point is - 26 letters , on average, could reduce 10000 directories by a twenty-sixth of that, 390 odd, unless ALL your directories start with "D" Second letter: 'Note - gets faster the fewer elements scan the array (not your directory listing) for the pair of letters, marking only the required ones. delete unmarked array elements (or listbox elements) redim array (?) - not sure here - maybe a second array with items from first Anyway, it's possible you're now down to one twenty-sixth of 390 - What's that about. ummm. 'bout 15 I think Third letter: repeat above for a trio of letters 'note: even fewer elements - faster still repeat until you're down to the directory group you want (or even single directory) somewhere in there, there's recursion. someone out there who understands recursion better than I do could point you in the right direction. Whatever you do, the above gives you the approach. Now it's time to put your thinking cap on (or wait till Someone starts the ball rolling) Graham
|
Fri, 05 Jul 2013 19:45:38 GMT |
|
 |
Hennin #5 / 14
|
 insert letter after letter within a short time vb6
Quote:
>> > Hello my friends >> > I want to search a directory very quick. This directory conists of >> > 10000 subdirectories with several almost the same names, like DEMO0001 >> > to DEMO9000 When I press the D, the program immediately start to >> > search the subidrectories which name starts with a D. and after typing >> > the E, the program starts again searching for subdirectories, which >> > name starts with DE, etc. This takes a little too much time, so I >> > guess it would be better to first create a searchstring very quickly >> > and start the seach after I wait 0.5 second. >> > Any idea? >> > thanks >> > Catharinus >> Or you could wait for the <Enter> key. >> /Henning > Yes, I thoiught about that, but.. > Any idea?
Private Sub YourTextBox_KeyPress(KeyAscii As Integer) If KeyAscii = vbKeyReturn Then KeyAscii = 0 'remove Enter key from buffer here so it doesn't trigger something else .... Do your stuff here .... End If End Sub /Henning
|
Fri, 05 Jul 2013 19:18:19 GMT |
|
 |
Catharinu #6 / 14
|
 insert letter after letter within a short time vb6
Quote:
> > Hello my friends > > I want to search a directory very quick. This directory conists of > > 10000 subdirectories with several almost the same names, like DEMO0001 > > to DEMO9000 When I press the D, the program immediately start to > > search the subidrectories which name starts with a D. and after typing > > the E, the program starts again searching for subdirectories, which > > name starts with DE, etc. This takes a little too much time, so I > > guess it would be better to first create a searchstring very quickly > > and start the seach after I wait 0.5 second. > > Any idea? > > thanks > > Catharinus > One of a hundred ways to do what you want - > First letter: > scan subdirectories and add to an array (or listbox, whatever). > The point is - 26 letters , on average, could reduce 10000 directories by a > twenty-sixth of that, 390 odd, unless ALL your directories start with "D" > Second letter: ? 'Note - gets faster the fewer elements > scan the array (not your directory listing) for the pair of letters, marking > only the required ones. > delete unmarked array elements (or listbox elements) > redim array (?) - not sure here - maybe a second array with items from first > Anyway, it's possible you're now down to one twenty-sixth of 390 - What's that > about. ? ummm. 'bout 15 I think > Third letter: > repeat above for a trio of letters ?'note: even fewer elements - faster still > repeat until you're down to the directory group you want (or even single directory) > somewhere in there, there's recursion. someone out there who understands > recursion better than I do could point you in the right direction. > Whatever you do, the above gives you the approach. Now it's time to put your > thinking cap on (or wait till Someone starts the ball rolling) > Graham
Hallo Graham thanks for your letters. That's how I worki: putting the scanned directories to an array, etc. But mayby I will have to think it over again. Thanks Catharinus
|
Fri, 05 Jul 2013 20:43:35 GMT |
|
 |
Catharinu #7 / 14
|
 insert letter after letter within a short time vb6
Quote:
> >> > Hello my friends > >> > I want to search a directory very quick. This directory conists of > >> > 10000 subdirectories with several almost the same names, like DEMO0001 > >> > to DEMO9000 When I press the D, the program immediately start to > >> > search the subidrectories which name starts with a D. and after typing > >> > the E, the program starts again searching for subdirectories, which > >> > name starts with DE, etc. This takes a little too much time, so I > >> > guess it would be better to first create a searchstring very quickly > >> > and start the seach after I wait 0.5 second. > >> > Any idea? > >> > thanks > >> > Catharinus > >> Or you could wait for the <Enter> key. > >> /Henning > > Yes, I thoiught about that, but.. > > Any idea? > Private Sub YourTextBox_KeyPress(KeyAscii As Integer) > ? If KeyAscii = vbKeyReturn Then > ? ? KeyAscii = 0 ? 'remove Enter key from buffer here so it doesn't trigger > something else > ? ? .... > ? ? Do your stuff here > ? ? .... > ? End If > End Sub > /Henning- Tekst uit oorspronkelijk bericht niet weergeven - > - Tekst uit oorspronkelijk bericht weergeven -
Thanks Henning that's how it's done I have introduced your suggestion in the program. Tenks Catharinus
|
Fri, 05 Jul 2013 20:44:29 GMT |
|
 |
Larry Serflate #8 / 14
|
 insert letter after letter within a short time vb6
Quote: > Hello my friends > I want to search a directory very quick. This directory conists of > 10000 subdirectories with several almost the same names, like DEMO0001 > to DEMO9000 When I press the D, the program immediately start to > search the subidrectories which name starts with a D. and after typing > the E, the program starts again searching for subdirectories, which > name starts with DE, etc. This takes a little too much time, so I > guess it would be better to first create a searchstring very quickly > and start the seach after I wait 0.5 second. > Any idea? > thanks
If you want to show the user the list so far, then grab only the first 25 that match and show them (or the first 50, or whatever size your list is). When they hit the enter key, or tab off the entry box, then do a full search for all the matches. If you don't show the user the list as they type, then wait for the Enter key as shown elsewhere in the thread.... LFS
|
Fri, 05 Jul 2013 23:27:21 GMT |
|
 |
Catharinu #9 / 14
|
 insert letter after letter within a short time vb6
Quote:
> > Hello my friends > > I want to search a directory very quick. This directory conists of > > 10000 subdirectories with several almost the same names, like DEMO0001 > > to DEMO9000 When I press the D, the program immediately start to > > search the subidrectories which name starts with a D. and after typing > > the E, the program starts again searching for subdirectories, which > > name starts with DE, etc. This takes a little too much time, so I > > guess it would be better to first create a searchstring very quickly > > and start the seach after I wait 0.5 second. > > Any idea? > > thanks > If you want to show the user the list so far, then grab only the first > 25 that match and show them (or the first 50, or whatever size your > list is). ?When they hit the enter key, or tab off the entry box, then do > a full search for all the matches. > If you don't show the user the list as they type, then wait for the Enter > key as shown elsewhere in the thread.... > LFS
Thanks I was also thinking about that option Looks nics Thanks Catharinus
|
Sat, 06 Jul 2013 00:45:19 GMT |
|
 |
Nobod #10 / 14
|
 insert letter after letter within a short time vb6
Quote: > Private Sub YourTextBox_KeyPress(KeyAscii As Integer) > If KeyAscii = vbKeyReturn Then > KeyAscii = 0 'remove Enter key from buffer here so it doesn't trigger > something else > .... > Do your stuff here > .... > End If > End Sub
Or just add a Search button with Default = True so adding KeyPress code is not required.
|
Sat, 06 Jul 2013 00:53:36 GMT |
|
 |
Catharinu #11 / 14
|
 insert letter after letter within a short time vb6
Quote:
> > Private Sub YourTextBox_KeyPress(KeyAscii As Integer) > > ?If KeyAscii = vbKeyReturn Then > > ? ?KeyAscii = 0 ? 'remove Enter key from buffer here so it doesn't trigger > > something else > > ? ?.... > > ? ?Do your stuff here > > ? ?.... > > ?End If > > End Sub > Or just add a Search button with Default = True so adding KeyPress code is > not required.
tenks
|
Sat, 06 Jul 2013 01:13:53 GMT |
|
 |
Helmut_Meuke #12 / 14
|
 insert letter after letter within a short time vb6
Catharinus schrieb am 16.01.2011 : Quote: > Hello my friends > I want to search a directory very quick. This directory conists of > 10000 subdirectories with several almost the same names, like DEMO0001 > to DEMO9000 When I press the D, the program immediately start to > search the subidrectories which name starts with a D. and after typing > the E, the program starts again searching for subdirectories, which > name starts with DE, etc. This takes a little too much time, so I > guess it would be better to first create a searchstring very quickly > and start the seach after I wait 0.5 second. > Any idea?
Did you actually test this scenario with about 10,000 entries in the directory? I know that with some 20,000 files in a directory, Explorer might behave very sluggish in showing the directory content. Helmut.
|
Mon, 08 Jul 2013 17:56:48 GMT |
|
 |
Catharinu #13 / 14
|
 insert letter after letter within a short time vb6
Quote: > Catharinus schrieb am 16.01.2011 : > > Hello my friends > > I want to search a directory very quick. This directory conists of > > 10000 subdirectories with several almost the same names, like DEMO0001 > > to DEMO9000 When I press the D, the program immediately start to > > search the subidrectories which name starts with a D. and after typing > > the E, the program starts again searching for subdirectories, which > > name starts with DE, etc. This takes a little too much time, so I > > guess it would be better to first create a searchstring very quickly > > and start the seach after I wait 0.5 second. > > Any idea? > Did you actually test this scenario with about 10,000 entries in the > directory? > I know that with some 20,000 files in a directory, Explorer might behave > very sluggish in showing the directory content. > Helmut.
Yes I did And it is not an explorer application but a desktop application Catharinus
|
Tue, 09 Jul 2013 00:12:52 GMT |
|
 |
Mike #14 / 14
|
 insert letter after letter within a short time vb6
Quote:
>> Catharinus schrieb am 16.01.2011 : >>> Hello my friends >>> I want to search a directory very quick. This directory conists of >>> 10000 subdirectories with several almost the same names, like DEMO0001 >>> to DEMO9000 When I press the D, the program immediately start to >>> search the subidrectories which name starts with a D. and after typing >>> the E, the program starts again searching for subdirectories, which >>> name starts with DE, etc. This takes a little too much time, so I >>> guess it would be better to first create a searchstring very quickly >>> and start the seach after I wait 0.5 second. >>> Any idea? >> Did you actually test this scenario with about 10,000 entries in the >> directory? >> I know that with some 20,000 files in a directory, Explorer might behave >> very sluggish in showing the directory content. >> Helmut. > Yes I did > And it is not an explorer application but a desktop application > Catharinus
I didn't see this suggested earlier, apologies if I missed it, would it be feasible to use one or more index files that contains all of the filenames, along with the full paths to the files? Searching that file in memory would probably be significantly faster than searching the hard drive.
|
Wed, 10 Jul 2013 08:25:42 GMT |
|
|
|