I have this simple code:
ListBox1.DataSource = MGlobals.UserList
ListBox1.DisplayMember = "Nome"
ListBox1.ValueMember = "ID"
when setting .ValueMember i get "
System.ArgumentException
HResult=0x80070057
Message=Não é possível vincular ao novo membro de apresentação.
Nome do parâmetro: newDisplayMember
"
debugging i found ListBox1.ValueMember
holding ""
and ListBox1.DisplayMember
holding "ID"
. Can anyone help me? Thanks.
Assuming your datasource Does have the Nome and ID columns, you could try changing the order to something like this:
ListBox1.DisplayMember = "Nome"
ListBox1.ValueMember = "ID"
ListBox1.DataSource = MGlobals.UserList
User contributions licensed under CC BY-SA 3.0