listview displaymember prpperty problem (Pls Help)
-
ListBox DataSource DisplayMember Property Problems in C# I have a (single select) listbox with data and when I click on the list I can't get the right text selected. My listbox is setup using the DataSource property. I set my ValueMember and DisplayMember listBox1.ValueMember = "TypeID"; listBox1.DisplayMember = "Name"; I am able to get the "TypeID" (ValueMember) when I click on the items. I do that like this... int intTest; intTest = System.Int32.Parse(listBox1.SelectedValue.ToString ()); But I can't get the text (DisplayMember). I have used these two ways, but... string strDispMem; strDispMem = listBox1.Items[index].ToString(); // the above returns... "System.Data.DataRowView" or strDispMem = listBox1.Text; // The above repeats first selection the user clicks on. Any ideas??? vipin Paliwal
-
ListBox DataSource DisplayMember Property Problems in C# I have a (single select) listbox with data and when I click on the list I can't get the right text selected. My listbox is setup using the DataSource property. I set my ValueMember and DisplayMember listBox1.ValueMember = "TypeID"; listBox1.DisplayMember = "Name"; I am able to get the "TypeID" (ValueMember) when I click on the items. I do that like this... int intTest; intTest = System.Int32.Parse(listBox1.SelectedValue.ToString ()); But I can't get the text (DisplayMember). I have used these two ways, but... string strDispMem; strDispMem = listBox1.Items[index].ToString(); // the above returns... "System.Data.DataRowView" or strDispMem = listBox1.Text; // The above repeats first selection the user clicks on. Any ideas??? vipin Paliwal
listBox1.SelectedText ( from memory ) - it's something like that.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
listBox1.SelectedText ( from memory ) - it's something like that.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
i not understand what u say, sorry. pls give me brif vipin paliwal
-
ListBox DataSource DisplayMember Property Problems in C# I have a (single select) listbox with data and when I click on the list I can't get the right text selected. My listbox is setup using the DataSource property. I set my ValueMember and DisplayMember listBox1.ValueMember = "TypeID"; listBox1.DisplayMember = "Name"; I am able to get the "TypeID" (ValueMember) when I click on the items. I do that like this... int intTest; intTest = System.Int32.Parse(listBox1.SelectedValue.ToString ()); But I can't get the text (DisplayMember). I have used these two ways, but... string strDispMem; strDispMem = listBox1.Items[index].ToString(); // the above returns... "System.Data.DataRowView" or strDispMem = listBox1.Text; // The above repeats first selection the user clicks on. Any ideas??? vipin Paliwal