?
Solved

Very Easy Newbie VB QN

Posted on 2003-03-24
3
Medium Priority
?
140 Views
Last Modified: 2010-05-01
How do you create a control at runtime?  Say I want to create an array of combo boxes at runtime,  

Set DataComboMatrix(i, j) = ???
0
Comment
Question by:chaplt01
3 Comments
 
LVL 44

Accepted Solution

by:
bruintje earned 140 total points
ID: 8193810
Hello chaplt01,

you could take a look at this
http://www.vbexplorer.com/VBExplorer/vb_feature/april2000/april2000.asp

HAGD:O)Bruintje
0
 
LVL 77

Expert Comment

by:GrahamSkan
ID: 8193951
You can only create an array at design time. You can do this by setting the index of a control to a number. So that you then might have a control such as Combo1(0).
You can add other members at run time with the load statement:

Load Combo1(1)
Load Combo1(2)

You can't create an array with more than one dimension, as in your example, though.
0
 
LVL 1

Expert Comment

by:FunkyMeister
ID: 8199854
You can create any client object at run time easily using API calls.

Though this can be risky if you're not familiar with API calls, a good suggestion is to search for "API" and "DrawFrameControl"

Declare Function DrawFrameControl Lib "user32" Alias "DrawFrameControl" (ByVal hDC As Long, lpRect As RECT, ByVal un1 As Long, ByVal un2 As Long) As Long

A good place to look is AllAPI.net, they have a program (http://www.allapi.net/agnet/apiguide.shtml) there that'll let you scan and read up on these functions.  With the hDC of your window, you can ADD many types of controls to your window at runtime.  Just remember though, a good programming technique is to remove them before you're done (although a window will remove all clients inside of it at closure, it's always best to do your own housekeeping).

API calls aren't for the faint of heart, but having a program that keeps all the definations and what they mean (with examples), gives you a lot to go on.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses

593 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