Solved

How to populate combobox dropdown from existing collection without looping

Posted on 2000-04-30
7
323 Views
Last Modified: 2010-05-02
How to populate combobox dropdown list from existing collection without looping and display multiple columns in selection list. Maybe by using a grid as the drop down list.
0
Comment
Question by:dbishop
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 6

Expert Comment

by:Marine
ID: 2764265
How would you ? You have to loop though a collection to populate it , i don't think there is another way.
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2764272
you cant, you have to recurse through and add the items.  if you had the information in a database you can use the datacombo control though.
0
 

Author Comment

by:dbishop
ID: 2764275
Edited text of question.
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 28

Accepted Solution

by:
AzraSound earned 500 total points
ID: 2764280
i think what you want to use is the listview control.  its like a listbox but it supports multi columns.  if this interests you let me know and i can post some code on how to use it.
0
 
LVL 7

Expert Comment

by:Vbmaster
ID: 2764284
It ain't that hard to create your own combobox, all you need is a simple textbox, a picturebox and the grid. You use the Line method to draw a pressed or unpressed button interface on the picturebox (you can not use a normal commandbutton because it will look terrible when it has the focus), in the MouseDown event draw a pressed button and in the MouseUp event draw a unpressed button. In the MouseUp event you also want to toggle the visibility of your grid. Voila! You have a combobox that has a grid as the dropdown control.
0
 
LVL 7

Expert Comment

by:Vbmaster
ID: 2764286
Here's the code I use to draw the button interface on the picturebox.

Public Sub DrawDown()

  'This will draw a pressed button interface
  'in the picButton picturebox, emulating a
  'real commandbutton
  picButton.Cls
  picButton.Line (0, 0)-(15, 16), vb3DShadow, B
  picButton.Line (5, 7)-Step(7, 0), vbBlack
  picButton.Line (6, 8)-Step(5, 0), vbBlack
  picButton.Line (7, 9)-Step(3, 0), vbBlack
  picButton.Line (8, 10)-Step(1, 0), vbBlack

End Sub

Public Sub DrawUp()

  'This will draw a unpressed button interface
  'in the picButton picturebox, emulating a
  'real commandbutton
  picButton.Cls
  picButton.Line (0, 0)-(0, 17), vbWhite
  picButton.Line (0, 0)-(15, 0), vb3DLight
  picButton.Line (0, 0)-(0, 16), vb3DLight
  picButton.Line (1, 15)-(15, 15), vb3DShadow
  picButton.Line (14, 1)-(14, 15), vb3DShadow
  picButton.Line (0, 16)-(15, 16), vbBlack
  picButton.Line (1, 1)-(14, 1), vbWhite
  picButton.Line (1, 1)-(1, 15), vbWhite
  picButton.Line (15, 0)-(15, 17), vbBlack
  picButton.Line (4, 6)-Step(7, 0), vbBlack
  picButton.Line (5, 7)-Step(5, 0), vbBlack
  picButton.Line (6, 8)-Step(3, 0), vbBlack
  picButton.Line (7, 9)-Step(1, 0), vbBlack

End Sub
0
 

Author Comment

by:dbishop
ID: 2764295
Yes, please send me an example.

I have to make a selection from a drop down list. Each row will have three columns.

my email is:
hdbishopjr@hotmail.com

Thanks,
Dave
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question