Link to home
Start Free TrialLog in
Avatar of al4629740
al4629740Flag for United States of America

asked on

place a list from one combobox to another in VB6

I am trying to take a list from one dropdown box and place it in another.  Only values starting with "IVPA"  The following code is not working.  Can any of your experts see why?

For l = 0 To frmRegistrationCSW.Text1.ListCount - 1
        If UCase(Left$(frmRegistrationCSW.Text1.List(l), 4)) = "IVPA" Then
        frmDataEnvIVPAPlan.Combo1.AddItem frmRegistrationCSW.Text1.List(l)
        End If
    Next l
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

In this line and others

For l = 0 To frmRegistrationCSW.Text1.ListCount - 1

Text1 should be the name of the Combobox.
removed
Avatar of al4629740

ASKER

Text1 is the name of the Combobox...
ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Everything in Text1 list is moved over to Combo1 list.   I need to isolate it to only things beginning with "IVPA"   It does not do that.
I did this

Private Sub Form_Load()
Text1.AddItem "IVPA1fggfgf"
Text1.AddItem "testtest"
Text1.AddItem "IVPA2"

End Sub

Open in new window


and only the 1st and 3rd where moved.

Can you attach a zip of your project?
Aha.  It does work.  The problem was that the list was also populating from another location and I was getting it to work with the code above and also getting the full list from another part in the code.

Thanks for all your help
You're welcome and I'm glad I was able to help.

My profile contains links to some articles I've written that may interest you.
Marty - MVP 2009 to 2012