Results 1 to 3 of 3

Thread: How can I clone ComboBoxes?

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Posts
    3

    Post

    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 ;->

  2. #2
    Hyperactive Member razzaj's Avatar
    Join Date
    Oct 1999
    Location
    jounieh
    Posts
    261

    Post

    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



  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Posts
    3

    Post

    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 ;->

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width