Solved

Creating Objects at runtime, Collections

Posted on 1999-01-24
5
129 Views
Last Modified: 2010-05-03
I am reading categories from a table, I would like to create
a checkbox for each category on a form so that the user can select which categories they wish to view. Categories can be added or deleted, therefor the control need to be built at runtime.
0
Comment
Question by:paulmck
  • 3
5 Comments
 

Author Comment

by:paulmck
ID: 1470377
Edited text of question
0
 

Author Comment

by:paulmck
ID: 1470378
Adjusted points to 8
0
 
LVL 4

Expert Comment

by:mcix
ID: 1470379
One approach would be to use a standard ListBox Control and set the Style to CheckBox.

You could then determine which categories are selected like this:

For i = 0 To List1.ListCount - 1
    If List1.Selected(i) Then
        MsgBox List1.List(i)
    End If
Next i

0
 
LVL 12

Accepted Solution

by:
mark2150 earned 10 total points
ID: 1470380
VB5 requires you to have a control array already on your form. Once it's there you can simply add elements to it for as many items as you wish. Difficulty is that the code for the control cannot be added dynamically so your event handling has to be smart enough to behave correctly no matter how many elements are present. .LBound and .UBound properties will tell your routine how many controls have been created in the array.

Thats a *lot* of help for a lousy 8 point question!

M

0
 

Author Comment

by:paulmck
ID: 1470381
Wasn't quite what i had in mind but a good solution. Thanks for your prompt answer.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Macro which automatically send Excel spreadsheet to Outlook problem 2 65
VBA error replacing data 6 40
VBA filters 2 61
Add a task in Outlook from access 11 39
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

770 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