General discussion

Locked

Create control array at runtime in VB6.0

By kw_ng ·
Hi. I have managed to create new control (textbox) at runtime in VB6.0 but it cannot create a textbox with multiline property.
So I have decided to create a multiline textbox
with index set to 0 (control array). Then at runtime, I hope to generate new similar multiline textbox for the existing one but I do not know how to do it? Any help is highly appreciated.

This conversation is currently closed to new comments.

7 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by kw_ng In reply to Create control array at r ...

Sorry for adding more comments. I have created control arrays for the textbox and others (listboxes, comboboxes, listboxes and frames) using load. The programme ran fine except when I
tried to end it. When I end it, it crashed (the programme crashed and VB 6.0 exit but the PC and others are fine). I have tried ending it using end from a button click and also no stopping of programme in VB stop command. In both cases, VB crash and prompt me to send a report to Microsoft. I hope someone knows why.

Collapse -

This should be simple

by kcampbell In reply to

you have to unload the controls. I use this little sub

Sub unloadCntlArray(ByRef cntlArray As Object)
On Error Resume Next 'only error
Dim cntl As Control
For Each cntl In cntlArray
If cntl.index <> 0 Then Unload cntl
Next
End Sub

Collapse -

by kw_ng In reply to Create control array at r ...

Sorry for adding more comments. I have created control arrays for the textbox and others (listboxes, comboboxes, listboxes and frames) using load. The programme ran fine except when I
tried to end it. When I end it, it crashed (the programme crashed and VB 6.0 exit but the PC and others are fine). I have tried ending it using end from a button click and also no stopping of programme in VB stop command. In both cases, VB crash and prompt me to send a report to Microsoft. I hope someone knows why.

Collapse -

by kw_ng In reply to Create control array at r ...

Sorry for adding more comments. I have created control arrays for the textbox and others (listboxes, comboboxes, listboxes and frames) using load. The programme ran fine except when I
tried to end it. When I end it, it crashed (the programme crashed and VB 6.0 exit but the PC and others are fine). I have tried ending it using end from a button click and also no stopping of programme in VB stop command. In both cases, VB crash and prompt me to send a report to Microsoft. I hope someone knows why.

Collapse -

by kw_ng In reply to Create control array at r ...

I have created the control array programme using load. But it kept crashing when I tried to stop aor end the programme. Crash here means vb crash and exit but the rest of windows is fine. Any clue?

Collapse -

Runtime Controls used in Visual basic 6.0

by ritesh_664 In reply to Create control array at r ...

Hay My Name is Ritesh Kumar. I am directly explain the code for creating runtime controls.
dim lbl as label
dim withevents txt as textbox
dim withevents cbo as combobox
dim withevents cmdadd as commandbutton
'With the help of withevents the variable of commandbutton cmdadd is add in the object combobox which is show at the top of form
private sub form_load()
set lbl= me.controls.add("vb.Label","NewLabel1)
lbl.height=200
lbl.width=1200
lbl.left=120
lbl.top= 240
lbl.visible=true
set txt=me.controls.add("vb.Textbox","newText1)
'Declare the position of textbox same as above and at last type
txt.visible=true
same as you can also create combobox and commandbutton

Collapse -

need to create array of controls

by ramaravind1986 In reply to Runtime Controls used in ...

hi ritesh,
fine i have got ur ideaa but i want to creat an array of controls
lik command1(1)

or something lik that hope u would have understood

if u know pls mail me

im aravind
ram_aravind1986@yahoo.com

Back to Web Development Forum
7 total posts (Page 1 of 1)  

Related Discussions

Related Forums