Hey all
I have a problem in my code I can't seem to find a solution for..
One combobox is being filled up with a datatable like this:
CbUsers.Datasource = usersDAO.getUsers()
The getUsers() returns a datatable from my acces database.
Users have a name and id, I want to use both of them but it should be something like this:
CbUsers.DisplayMember = "username"
CbUsers.valueMember = "userid"
In other words, I want to see the user name, but work with the user ID. So far the code worked, but it only displays stuff.
Now, in a method I want to use the id of the selected user in the combobox but that has been given me some trouble.
If I use this line I get a DataRowView:
CbUsers.selectedValue
When I try to retrieve information from it, it throws an exception.
I've tried lots of different code and it never worked..
If I put the DataRowView in a local variable and do this:
id = drv.items(0)
I only get exceptions..
Can someone help me fix my code? Or maybe provide a way to work with a combobox that displays usernames but works with their id's?
Thanks in advance,
Lupus