954,557 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

eliminate duplicate items in combobox! pls help!

can someone tell me how to do this???
i have a product category in a combobox and the associated product codes in a list box.
i'm using oracle for backend.

the combobox on form loading shows the product categories from oracle database.
but the product category is not a primary key in the db . hence the combobox shows all the duplicate categories as well, which i dont want.
the list box shows the product codes associated with each item in the combobox wen a particular product category is selected in the combobox. the product code is a primary key.
i need the listbox to show all product codes associated with one particular selected category in the combobox.
since code and category are in the same table (product) , i cant make the category as a primary key too.
how do i go about with it???

shalini_roy
Newbie Poster
12 posts since Jun 2006
Reputation Points: 10
Solved Threads: 0
 

Sounds like you need to take code out of the same table as category, might help make the system more usable.

agrothe
Junior Poster
153 posts since Jun 2006
Reputation Points: 37
Solved Threads: 18
 

Post some code for it.

Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

i transferred the product category to another table.

shalini_roy
Newbie Poster
12 posts since Jun 2006
Reputation Points: 10
Solved Threads: 0
 
i transferred the product category to another table.



*use distinct to get single item entered into combobox.

pkb_pkb
Newbie Poster
2 posts since Jun 2006
Reputation Points: 10
Solved Threads: 0
 

well I dont exacly understand why ur trying to do. I presume you're listing items from textfile. So to delete "duplicated items" simply use this code :

'there is the code to add item from richtextbox 1by1 , in case of.

dim infoD As New IO.DirectoryInfo(RichTextBox1.Text)
Dim infoF As IO.FileInfo() = di.GetFiles()
Dim di As IO.FileInfo

For Each di In infoF
Dim lol As String = di.ToString
lol = System.IO.Path.GetFileNameWithoutExtension(lol)
'here is the code to prevent duplicated items .
If ComboBox1.Items.Contains(lol) Then

Else
ComboBox1.Items.Add(lol)
End If
Next


Hope that helped you !! ~Ben

ibennz
Newbie Poster
3 posts since Aug 2010
Reputation Points: 10
Solved Threads: 0
 

@ibennz Please don't respond to 4 year old threads. Kindly appreciated.

agrothe
Junior Poster
153 posts since Jun 2006
Reputation Points: 37
Solved Threads: 18
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You