Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15648

VS 2012 How to add a unique index (client id) for a combo box in VB 2012

$
0
0
I'm loading a client list into a combo box and ordering by client name, this means that the client ID field is not in order.

I can add the names into the list no problem, but can't set the index property as the client id. I receive the error "InvalidArgument=Value of '19' is not valid for 'index'."

Code:

cboClients.Items.Insert(index,"Client Name")
I assume index has to run consecutively and can't be set out of order

Is there a way round this. I know this was possible VB6

Code:

cboClients.AddItem "Client Name"
cboClients.ItemData(cboClients.NewIndex) = 55

On Click of Combo would be
Code:

value = cboClients.ItemData(cboClients.ListIndex)
value would be 55

Viewing all articles
Browse latest Browse all 15648

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>