Solved

How do you set the default style for a dynamic ComboBox? vb6

Posted on 2006-11-21
6
838 Views
Last Modified: 2008-01-09
I am dynamically creating several comboboxes and I need them to have a style of 2. However, this cannot be set at runtime. Is there a way to set the style upon creation of the control.

This does NOT work:
Set cbo = Controls.Add("vb.ComboBox", "cbo")
    MsgBox cbo.Name
    cbo.Style = 2
    cbo.Width = 2000
    cbo.Top = Me.Height / 2 - cbo.Height / 2 - 2000
    cbo.Left = Me.Width / 2 - cbo.Width / 2 - 1000
    cbo.Visible = True
   
0
Comment
Question by:Bullfighter
6 Comments
 
LVL 10

Expert Comment

by:Clif
ID: 17988951
0
 
LVL 2

Author Comment

by:Bullfighter
ID: 17989345
Well, there is certainly a lot of information in here, it will take me a bit to see if it answers my question. I do find it a little amusing that there is a combo box that uses the dropdown list style (2), but it is set manually not through this process.
0
 
LVL 28

Accepted Solution

by:
AzraSound earned 500 total points
ID: 17990267
It's read-only at run-time, so you have to completely destroy and recreate the window from scratch if you want to approach it that way, which requires some effort.  You may consider just having pre-loaded combos with different styles as part of a control array with an Index of 0, and then load needed ones thereafter from the appropriate styled combo array.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
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…

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