I gave datatable as datasource to Lisbox.
That tables fields are ID, Subject, Texts and ID is an Unique field(PK).
But Subject shown as DisplayMember.
Here is my datasource giving code:
lbTexts.DataSource = mDataSet.Tables["Story"];
lbTexts.DisplayMember = "Subject";
i want to know which rows the user has selected and what is the Unique value.
i find it with 10 rows of code. But i hope there is a simple way to find it.
If you use the ValueMember property and set it to Id, you can use the SelectedValue parameter without needing the entire dataset. You’re also guaranteed to not get resorting errors where the selected index in the list doesn’t match the index in the data.