467,151 Members | 948 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,151 developers. It's quick & easy.

VB6 combo box list items

I have 6 combo boxes on a vb form. Is there a way, using vb6, to remove the list item that was selected in the first combo box from the list of the second, third fourth, fifth, and sixth combo box list?

This is what I have tried with no luck

Expand|Select|Wrap|Line Numbers
  1. cb = combobox1.listindex
  2. combobox2.list = combobox1.list
  3. combobox2.removeitem cb 
Nov 28 '06 #1
  • viewed: 23020
Share:
3 Replies
1GB
I have 6 combo boxes on a vb form. Is there a way, using vb6, to remove the list item that was selected in the first combo box from the list of the second, third fourth, fifth, and sixth combo box list?

This is what I have tried with no luck

Expand|Select|Wrap|Line Numbers
  1. cb = combobox1.listindex
  2. combobox2.list = combobox1.list
  3. combobox2.removeitem cb 
Yes you can do this. You need to have access to the data that is used to poplate the other combo boxes. If it is data from a database you can filter the source to exclude the row you don't want.
Nov 28 '06 #2
The combo box lists are not populated from a database. I put the following fields into the combo box list manually at design time as they will never increase or decrease.

The six fields in the Access 2003 db are:

Date_In
Date_Out
Time_In
Time_Out
Unit
Document_Id

So, if user selects Date_In in combobox1 then I want to remove Date_In from the list of combobox 2, combobox3, combobox4, combobox5, and combobox6. Then run the same procedure when I select from combobox2, and continue in the same fashion through all six combobox lists.

If it would be better to populate them from a database and use your procedure, could you point me in the right direction to find out how to do it?

Thanks
Nov 28 '06 #3
This is what I came up with. The code is executed on the click event of the combo box.


Expand|Select|Wrap|Line Numbers
  1. combobox1_click
  2. Dim uitem as Integer
  3. uitem = cboSearchField.ListIndex
  4. cboSearchField2.RemoveItem uitem
  5.  
This removes the selection I made in combobox1 from the selection list of the second combo
Nov 28 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Brad Allison | last post: by
2 posts views Thread by Jeremy Dillinger | last post: by
2 posts views Thread by Robert | last post: by
2 posts views Thread by kiranmn75@gmail.com | last post: by
6 posts views Thread by =?Utf-8?B?amVmZmVyeQ==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.