Solved

Multiselect listbox options in VB6 and VBA

Posted on 2007-03-19
2
966 Views
Last Modified: 2008-02-01
Hi Experts,

In converting a project from VBA to VB6, I've encountered a problem.

In VBA, the options for my listbox are:
Liststyle: 1
Multiselect: 0
This gives a listbox with radio button type controls, ie each line in the list can only be selected once (as opposed to the version with tick boxes where you can select many times)

In VB6 the options for my listbox are:
either
Style 0
Multiselect 0
This has the same features, ie you can only select one item at a time, but there are no radio buttons - so it looks a bit strange.  Alternatively, if you set style to 1, you get checkboxes which doesn't make sense with an individual item select.

Is there any way to get VB6 to do the radio buttons for individual item select the way that VBA does?

Thanks in advance,

PatternNut



0
Comment
Question by:PatternNut
2 Comments
 
LVL 4

Accepted Solution

by:
psychakias2 earned 500 total points
ID: 18753427
You do you this by using the exact same control that VBA uses.

Right click on your Toolbox and select COMPONENTS.
From the list that pops up, select MICROSOFT FORMS 2.0 OBJECT LIBRARY.

After you do this, you will be able to see in your toolbox some new controls, along with a new Listbox which when used, it will give you the behavior you want.
0
 

Author Comment

by:PatternNut
ID: 18760887
Wow.  That was easy.  Thanks so much, I really appreciate it.

Cheers,

PatternNut
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
The Selection object is designed for user interaction. It has a Range property, so it can be used in most places that a Range object can. Recorded macros must use the Selection because they are simply copying what the user is doing. A Range prope…
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

896 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now