home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Tool Box
/
SIMS_2.iso
/
vb_code1
/
multibox
/
multipik.inf
< prev
next >
Wrap
Text File
|
1991-10-15
|
2KB
|
62 lines
Multiple Selection ListBox for VB
Costas Kitsos 73667,1755
Introduction:
I have only recently started looking into the possibility of creating a
Multiple Selection ListBox in VB without the need for third party Custom
Controls or other DLLs.
MULTIPIK contains a usable form of a Multiple Selection ListBox in the
context of MiniApp for Trovadore's Home Trattoria, a fictional home delivery
restaurant. The MultiPick ListBox presents Trovadore's Entrees and
the user can pick up to five from the ListBox. If the user marks more than
five items, only the first five are used.
Multiple Selection ListBoxes:
A Multiple Selection ListBox is a ListBox that allows the user to mark an
array of items in the ListBox. It's an extremely useful ListBox style since
there are many occasions when a few choices are required.
As we know, VB doesn't offer a Multiple Selection ListBox Control. Creating
a Multiple Selection ListBox is not an impossibility, though. MULTIPIK
demonstrates on method of creating such a ListBox.
MULTIPIK uses CreateWindow to create a Multiple Selection ListBox as a
child window on the VB form. Since VB windows are windows just like any
other windows this is completely acceptable. I used a VB ListBox, called
DummyList for both form design puproses and as a guide to placing and
sizing the Multiple Selection ListBox. DummyList is made invisible as
soon as during Form_Paint we determine it's measurements/placement. It's
replaced by the Multiple Selection ListBox that is exactly the same size
and at the same location as DummyList.
Of course, since this Multiple Selection ListBox is not actual VB Control
we can't trap events such as Click, KeyPress, etc. MULTIPIK shows you an
alternative way of getting the items we need.
The code is commented and should answer most of your questions.
Using MULTIPIK
To test MULTIPIK, open MULTIPIK.MAK and select RUN. Choose up to 5 dishes
from Trovadore's menu and click on OK. A MsgBox will pop up displaying your
selections and MULTIPIK will end. The limitation of 5 dishes is only there
for the purpose of this demo, there's certainly no such limitation in
Multiple Selection ListBoxes.
If you have any comments or make any improvements don't hesitate to contact
me through CompuServe Mail or on the MSBASIC forum.
Enjoy!
Costas Kitsos
October 1991