Click to See Complete Forum and Search --> : How can I clone ComboBoxes?
Jo
Nov 26th, 1999, 04:34 PM
Hi!
I'm forced to use 12 ComboBoxes in one form, and all have to be the same at ever time!
Only the first one can be changed, but every change has to occur in all boxes.
Is there any possibility to CLONE ComboBoxes?
Or how can I fill the first list and copy this list to the other ones?
Many thanks in avance
Jo ;->
razzaj
Nov 26th, 1999, 06:36 PM
well , u can create a control array by copying the combo-list (right click on combo , copy , paste) when vb prompts u "do u want to create a control array ??" answer yes..
what happens is u ll have the first combo named combo1(0) the second one combo1(1).....
till combo1(x) x increments by one each time u create a new combo list by pasting the original one ...(note if u draw manually
another combo list it will be called combo2
and will not be part of the array .
here is a sample code that will allow u to
copy what ever u enter in combo1(0) (which is the first one ) in the rest of the array:
insert the following in the form code :
Private Sub Combo1_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then
For x = 0 To 11
Combo1(x).AddItem Combo1(0)
Next x
Combo1(0) = ""
End If
End Sub
Private Sub Form_Load()
For x = 0 To 11
Combo1(x) = ""
Next x
Combo1(0) = " > ENTER HERE < "
End Sub
Jo
Nov 28th, 1999, 05:01 PM
Thx for that advise but I already use arrays (and i know how to make them :-)) ).
But what i wanted was some sort of real cloning.
I've heard, a class should do this trick.
Bu i've bever worked with classes before (except one time in Java).
Any other idea than arrays??
Jo ;->
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.