Member Avatar for Peric

Ok, this is what I need...
I select four columns(those are informations about payed fee for each it could have zero or more rows) from my database (from two different tables), one record as "ID" and other three (i've band them together) as "Rest".
Then, I've put that column "Rest" as a DisplayMember for my first ListBox...because I couldn't find a solution to put that "ID" column in the same ListBox, and make it invisible for user (I need "ID" column for accessing those fields about payed fee) I've made another ListBox and set DisplayMember = "ID". I've put that ListBox on Visible=False and when I select rows from first ListBox "ID" is also changing and on event "SelectedIndexChange" for first ListBox I'm trying to get this "ID", store it into Integer variable and then put it into another select query that will select only selected pay fee from database...everything of this works fine but when I try to put that data from the last select query (something like this: TextBox3.Text = dataTablePodaci.Rows(0).Item(1) ) to a different textboxes (because there are three columns in select) here comes the problem, suddenly. The thing is that I can't see my real records in the main ListBox anymore...and instead of that for all rows I get: "System.Data.DataRowView". Yes, and also...everything in the back works ok...when I select each "System.Data.DataRowView" row, I see that my ID is changing and also my select is working fine and values I select are also everything works instead that first/main Listbox got himself confused somehow.

Any ideas? Does anyone know if listbox is having some kind of ability to hide column, to put "ID" for each record of something?
I've tried to do this with DataGridView also but I had some problems (with date) so I've tried with ListBox...

Member Avatar for Peric

ok, i did it finally, like that:

ClanarinaListBox.DataSource = dataTableFee
ClanarinaListBox.DisplayMember = "Everything"
ClanarinaListBox.ValueMember = "ID"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.