How to check duplicate value into a listbox before saving into DB

Hi guys

Maybe somebody has already answered my question , but i want take the chance to ask again:
"How to check a duplicate value into a listbox before saving into DB ?

Thanks to all

Or don’t bother, and just put unique constraints on the database table, and let IT tell you…
otherwise sort the data and check the current element against the one you just entered

Hi Dave

Many thanks

Make a sort on a specific (meaningful) column, then compare Row 0 to Row 1, Row 1 to Row 2 and so on ?

Loop from 0 to myListBox.ListCount -1, checking if myListBox.Cell(row, column) = valueToInsert is true. If it is, then Exit and don’t insert the new row. If not found, then insert the value.

I’m with Dave on this. Let the DB do it for you.

Use a ListBox to just display the Data. Store it somewhere else. Maybe in a SQLite DB in Memory.
Then follow Dave’s advise. :wink:

Hi guys

Thanks to all for your help & support.