473,387 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

fast

Hi Gurus

What is the fatest way to select all the items in a list box?

At the moment, I do this for each itm in ctl..... type of method, but with
more than 2,000 items, this can be a little slow.....

are there any commands that do the whole thing at once???

TIA

- Nicolaas
Nov 13 '05 #1
14 1466
"WindAndWaves" <ac****@ngaru.com> wrote:
What is the fatest way to select all the items in a list box?

At the moment, I do this for each itm in ctl..... type of method, but with
more than 2,000 items, this can be a little slow.....

are there any commands that do the whole thing at once???


Alternatively try turning echo off. Note that you'd best ensure you have an error
handling routine and turn echo on as the first thing in your error handling routine
or you'll never see any error messages and your app will be "frozen".

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 13 '05 #2
"WindAndWaves" <ac****@ngaru.com> wrote in
news:X%*******************@news.xtra.co.nz:
What is the fatest way to select all the items in a list box?

At the moment, I do this for each itm in ctl..... type of method,
but with more than 2,000 items, this can be a little slow.....

are there any commands that do the whole thing at once???


A listbox with 2000 items in is an abomination, user-hostile, a
performance nightmare.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #3
Dear Mr Fenton

And why would that be??? I guess you are right, may be I should rethink the
whole thing....
Nov 13 '05 #4
rkc

"WindAndWaves" <ac****@ngaru.com> wrote in message
news:dK*******************@news.xtra.co.nz...
Dear Mr Fenton

And why would that be??? I guess you are right, may be I should rethink the whole thing....


If you're building something that will be used by other people, ask them.
Nov 13 '05 #5
"WindAndWaves" <ac****@ngaru.com> wrote
And why would that be??? I guess you
are right, may be I should rethink the
whole thing....


The Microsoft publication "The Windows Interface - a Design Guide" (written
in Win 3.1 days) recommended no more than 20 - 50 items in a list that you
force your users to scroll through. Windows has changed since then, but
users have not.

A good reason: I would try an application that forced me to scroll through
2000 items just long enough to discover that's what it did, before
uninstalling it from my computer as _unusable_. I suspect I am not that
different from your users when it comes to long, long scrolls.

Larry Linson
Microsoft Access MVP


Nov 13 '05 #6
On Tue, 29 Jun 2004 09:23:44 +1200, "WindAndWaves" <ac****@ngaru.com>
wrote:

Why don't you tell us a bit more about what you want to accomplish
from a 10,000 foot level (approx 3048 meters :-)), so we may be able
to suggest alternatives.

-Tom.

Hi Gurus

What is the fatest way to select all the items in a list box?

At the moment, I do this for each itm in ctl..... type of method, but with
more than 2,000 items, this can be a little slow.....

are there any commands that do the whole thing at once???

TIA

- Nicolaas


Nov 13 '05 #7
"WindAndWaves" <ac****@ngaru.com> wrote in message news:<dK*******************@news.xtra.co.nz>...
Dear Mr Fenton

And why would that be??? I guess you are right, may be I should rethink the
whole thing....


Here's some thoughts that may be more helpful to you. If the combo box
has more than 100 choices it becomes a bit much for users to find what
they want and you are probably better off providing a search form for
them. This will perform better and be more helpful than making the
user wait while 2000+ records are sent over the network to the local
form and then making them scroll through them to find what they want.

There is some great reading here:

http://www.attcanada.net/~kallal.msn/Search/index.html

That will help define the issue and hopefully provide some
inspiration.

The key issue here is that the slowest part of database access is the
network - anything you can do to minimize the amount of data or number
of round-trips needed to get data over the network will make your
application more responsive, i.e., a "snappier" interface for your
users.

'---------------
' John Mishefske
'---------------
Nov 13 '05 #8
Hi NIcolaas,

I echo the sentiments of others here as to the number of items that might
belong in list boxes, comboboxes, etc. However, you could add a SelectAll
command button near your listbox and in its code index through the items in
the listbox setting

ListBox(I).Selected=True.

You must already have code to test for selected = True so writing the new
code should be a breeze.

HTH

p.s. One customer of mine (a department in a Huge bank) insisted that they
have their world-wide commercial borrower names and accounts searchable via
comboboxes. They wouldn't be dissuaded. There were something over 100,000
customers ... The first hit took about 20 seconds, subsequent hits about 5
seconds each.

--
-Larry-
--

"Larry Linson" <bo*****@localhost.not> wrote in message
news:tz*******************@nwrddc03.gnilink.net...
"WindAndWaves" <ac****@ngaru.com> wrote
> And why would that be??? I guess you
> are right, may be I should rethink the
> whole thing....
The Microsoft publication "The Windows Interface - a Design Guide"

(written in Win 3.1 days) recommended no more than 20 - 50 items in a list that you
force your users to scroll through. Windows has changed since then, but
users have not.

A good reason: I would try an application that forced me to scroll through
2000 items just long enough to discover that's what it did, before
uninstalling it from my computer as _unusable_. I suspect I am not that
different from your users when it comes to long, long scrolls.

Larry Linson
Microsoft Access MVP

Nov 13 '05 #9
"Larry Linson" <bo*****@localhost.not> wrote in message
news:tz*******************@nwrddc03.gnilink.net...
"WindAndWaves" <ac****@ngaru.com> wrote
> And why would that be??? I guess you
> are right, may be I should rethink the
> whole thing....
The Microsoft publication "The Windows Interface - a Design Guide"

(written in Win 3.1 days) recommended no more than 20 - 50 items in a list that you force your users to scroll through. Windows has changed since then, but
users have not.

A good reason: I would try an application that forced me to scroll through 2000 items just long enough to discover that's what it did, before
uninstalling it from my computer as _unusable_. I suspect I am not that
different from your users when it comes to long, long scrolls.


An assumption is being made here. That the app is forcing or expecting you
to scroll through all the rows it exposes. Not every ListBox is a bound
data control used to make entries. In many of my forms a ListBox is used
as a navigation or record selector. This was done explicitly for the
reason that I didn't want to load lots of records, but rather provide an
intuitive way for the user to specify those records that they need to see.

To that end the ListBox picks a couple of columns meaningful enough to the
user to let them select that particular record for viewing. The form then
has tools on it to provide filtering of the ListBox to narrow the choices.
In most cases I default the ListBox to zero rows and only populate it when
some filter criteria has been provided.

The user could very well enter a filter criteria that returns a couple
thousand rows. This does not mean that the user is expected to scroll
through the entire list. If the user has a brain in their head they know
that when the list is large it means they need to narrow their criteria
some more. In other cases the user is interested in reviewing "some"
records that satisfy a certain criteria. That criteria might result in
5000 rows in the ListBox, but they only need to review the first 5 or 6 to
accomplish their goal.

I'm not disagreeing with the basic UI premise that short lists are better
than long lists, but it bugs me a bit when I see these overly broad
statements along the lines of "any list with more than 100 rows is bad
design". What matters is whether it works well for the intended purpose.
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


Nov 13 '05 #10
List boxes are for scrolling (well, not if the list is sufficiently short)
and selection of information, whether bound or not. The original poster said
the list box had 2000 items. I was not, repeat not, dealing with "select
all" but with the design of the list box itself.

I'll stand by my statement, too, that any list box that [ever|normally]
requires a user to scroll through 2000 items is unusable in any practical
sense. And, if it were always a "Select All" situation, why bother with a
List Box? You certainly can't size it to show all 2000 list items, unless
you have a wall-size display, and even so, it'd have to be a large wall.

Larry Linson
Microsoft Access MVP
"Rick Brandt" <ri*********@hotmail.com> wrote in message
news:2k***********@uni-berlin.de...
"Larry Linson" <bo*****@localhost.not> wrote in message
news:tz*******************@nwrddc03.gnilink.net...
"WindAndWaves" <ac****@ngaru.com> wrote
> And why would that be??? I guess you
> are right, may be I should rethink the
> whole thing....
The Microsoft publication "The Windows Interface - a Design Guide"

(written
in Win 3.1 days) recommended no more than 20 - 50 items in a list that

you
force your users to scroll through. Windows has changed since then, but
users have not.

A good reason: I would try an application that forced me to scroll

through
2000 items just long enough to discover that's what it did, before
uninstalling it from my computer as _unusable_. I suspect I am not that
different from your users when it comes to long, long scrolls.


An assumption is being made here. That the app is forcing or expecting

you to scroll through all the rows it exposes. Not every ListBox is a bound
data control used to make entries. In many of my forms a ListBox is used
as a navigation or record selector. This was done explicitly for the
reason that I didn't want to load lots of records, but rather provide an
intuitive way for the user to specify those records that they need to see.

To that end the ListBox picks a couple of columns meaningful enough to the
user to let them select that particular record for viewing. The form then
has tools on it to provide filtering of the ListBox to narrow the choices.
In most cases I default the ListBox to zero rows and only populate it when
some filter criteria has been provided.

The user could very well enter a filter criteria that returns a couple
thousand rows. This does not mean that the user is expected to scroll
through the entire list. If the user has a brain in their head they know
that when the list is large it means they need to narrow their criteria
some more. In other cases the user is interested in reviewing "some"
records that satisfy a certain criteria. That criteria might result in
5000 rows in the ListBox, but they only need to review the first 5 or 6 to
accomplish their goal.

I'm not disagreeing with the basic UI premise that short lists are better
than long lists, but it bugs me a bit when I see these overly broad
statements along the lines of "any list with more than 100 rows is bad
design". What matters is whether it works well for the intended purpose.
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com

Nov 13 '05 #11
WindAndWaves wrote:
Hi Gurus

What is the fatest way to select all the items in a list box?

At the moment, I do this for each itm in ctl..... type of method, but with
more than 2,000 items, this can be a little slow.....

are there any commands that do the whole thing at once???

TIA

- Nicolaas

I still use my time honored way of making multiple selections from the
days before multiselect listboxes were available in Access, that is to
use 2 listboxes, the LH box has unselected items and the RH box has
selected items, there'll be field in the record for selecting, a select
all function would just batch update all the unselected items to
selected with a query and requery the listboxes, this generally occurs
in less than half a second even for large selections.

--
Error reading sig - A)bort R)etry I)nfluence with large hammer
Nov 13 '05 #12
Hey Trevor

that is a brilliant idea! Thank you.
Nov 13 '05 #13
To answer some of the questions:

I have, at times, several thousands items in the list boxes, but they are
not randomly displayed.

The listbox is in my printer manager. The print manager is a form that the
user can use to print reports.

They may, for example, say "filter by contacts" and there may be several
thousand contacts in the list. However, because they are sorted
alphabetically, all they need to do is scroll down the list to the
appropriate first letter, and so on. A bit like a telephone book.

I could add a search function for the lookup list, but at the mo moment, a
need to first make sure that the basics in the print manager work.

Thank you all for your interesting replies

- Nicolaas
Nov 13 '05 #14
WindAndWaves wrote:
To answer some of the questions:

I have, at times, several thousands items in the list boxes, but they are
not randomly displayed.

The listbox is in my printer manager. The print manager is a form that the
user can use to print reports.

They may, for example, say "filter by contacts" and there may be several
thousand contacts in the list. However, because they are sorted
alphabetically, all they need to do is scroll down the list to the
appropriate first letter, and so on. A bit like a telephone book.

I could add a search function for the lookup list, but at the mo moment, a
need to first make sure that the basics in the print manager work.

Thank you all for your interesting replies


Check out these pages for some illuminating ideas:

http://www.attcanada.net/~kallal.msn/Search/index.html

--
'-------------------------------
' John Mishefske
'-------------------------------

Nov 13 '05 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Michele Simionato | last post by:
I posted this few weeks ago (remember the C Sharp thread?) but it went unnoticed on the large mass of posts, so let me retry. Here I get Python+ Psyco twice as fast as optimized C, so I would like...
0
by: Dean J Garrett | last post by:
Does anyone know about "fast web view" for PDF files? We have a .NET application that opens PDF files as the user's request. The problem is that some of these are very large, 20MB, and it takes...
8
by: Neil | last post by:
I have a very puzzling situation with a database. It's an Access 2000 mdb with a SQL 7 back end, with forms bound using ODBC linked tables. At our remote location (accessed via a T1 line) the time...
22
by: Marc Mones | last post by:
Hello, I'working with IBM DB2 V8.1 and CLI/ODBC. I've got a problem with the following statement: ******************************************************************************** SELECT...
20
by: GS | last post by:
The stdint.h header definition mentions five integer categories, 1) exact width, eg., int32_t 2) at least as wide as, eg., int_least32_t 3) as fast as possible but at least as wide as, eg.,...
6
by: G.Esmeijer | last post by:
Friends, I would like to read a text file (fixed length formaated) really fast and store the data into an Access database (2003). Using the streamreader and reading line by line, separating the...
10
by: javuchi | last post by:
I just want to share some code with you, and have some comments and improvements if you want. This header file allocates and add and delete items of any kind of data from a very fast array: ...
95
by: hstagni | last post by:
Where can I find a library to created text-based windows applications? Im looking for a library that can make windows and buttons inside console.. Many old apps were make like this, i guess ...
0
by: Vinod Sadanandan | last post by:
Fast-Start Failover An Overview In Dataguard Environment ============================================================================= This article describes the automatic fast start failover...
9
by: Salad | last post by:
I have access, for testing at my client's site, a Win2000 computer running A2003 retail. He recently upgraded all of his other machines to DualCore Pentiums with 2 gig ram and run A2003 runtime. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.