Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add Control Array at run time?

Status
Not open for further replies.

cyberbiker

Programmer
Mar 16, 2001
431
US
I need to add a control array at run time.
I will need to add an array of text boxes, an array of labels, an array of combo boxes and an array of Check boxes.
It would be nice if I could add an array of frames but I can work around that.
What I am actually doing is using a tab strip control and adding a various number of tabs depending on the text file I read, There may be as few as 2 tabs and as many as someone can dream up (although at this point it lookss as if 10 or so will be the max).
I wish to use an array so I can use the click events easily .
I do know how to do this at design time and hope that it is possible to be done at run time
I need to create these controls on various tabs in various combinations and various numbers of controls.
I have been trying to do this by defining a variable as an array and using the Add Method(Controls Collections) that I found in HELP.
It seems no matter how I do it though I receive an error message of "Not a legal Object Name"
I need to use the tab strip or the SSTab Strip (Boss wants that style so that is firm) but am open to any and all suggestions.
The offending code follows. The last 2 lines are where the compiler becomes uncooperative :)
Terry
intGroupCount = intGroupCount + 1
Set tabX = frmUpdate.tabParam.Tabs.Add(intGroupCount)
tabX.Caption = strGroup

frmUpdate.Controls.Add "vbCombo", "cboValue(intGroupCount - 1)"
With frmUpdate.Controls("cboValue(intGroupCount - 1)")
 
You need to have one of whatever type control you want to make into an array already on your form. VB (at least in v6.0) doesn't allow you to start from scratch.

Chip H.
 
thanks for the help. no wonder I was going goofy :)
Please bear with me. I do not have much experience in VB except from a book. What I do have is DB related and this new job is really stretching my abilities.
I am a much better programmer than I was 4 weeks ago thougH :)
Terry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top