getting a value from a bound combobox
This may sound like a simple question, but being a self taught vb programmer it's apparently not that obvious to me.
I have a combobox that is bound to the "client" field of a dataset. How do I get the string value of the user's selected item? It seems like no matter what I try (selectedvalue.tostring, selectedtext.tostring, etc.) it returns system.data.datarowview or an empty string "".
Re: getting a value from a bound combobox
Code:
adaptSecurity.Fill(dsDataset, "TableName")
ropDownList1.DataSource = dsDataset.Tables("Tablename").DefaultView
DropDownList1.DataTextField = "fieldname"
Hey,
try something like this. Im also beginning to learn vb.net in a do-it yourself thing and this has worked for me. Hope it helps you out.
Re: getting a value from a bound combobox
not sure though but did you check the assign combobox .DisplayMember field and the .ValueMember because it may occurs that certain error.
Re: getting a value from a bound combobox
I assigned the .valuemember to that field and now I get the text I wanted from the selectedvalue.
Thank you.