Lachy
07-18-2003, 12:41 AM
How do I create object arrays from nothing? I'm aware that I can create an object that already exists over and over, but can I do it without putting one on the form first?
Creating ObjectsLachy 07-18-2003, 12:41 AM How do I create object arrays from nothing? I'm aware that I can create an object that already exists over and over, but can I do it without putting one on the form first? SpaceFrog 07-18-2003, 02:26 AM SOmething like this maybe ? dim a as integer 'a beeing number of controls for i=0 to a dim text as textbox set text=controls.add("vb.textbox","text"+cstr(i)) set text.container=form1 'container form with text .top=..... .left=..... 'positionning and properties .visible=true next i manavo 07-18-2003, 04:24 PM SpaceFrog, that puts one control. The problem that I think you will run into is that the index property of a control is read-only... So I am not sure if you can... manavo 07-18-2003, 04:26 PM For example if you add this line : .Index = 0 in the with block (which is missing an end with) you get a compile error saying that you can't assign a value to a read-only property. So I conclude that you probably can't (but you never know ;) ) SpaceFrog 07-19-2003, 08:08 AM Have u tried with set instruction to set index at time of creation ? I'm noy at work so I cannot test ... Set text=controls.add("vb.textbox","text"+cstr(i)) Set text.index = 0 Thinker 07-19-2003, 08:57 AM You can't. The Control array in VB must be created at design time. |
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum