0

Hi,

I created a checklistbox and binded the display value from a MS-Access table. Next, I am trying get the checked item but I keep getting "System.Data.DataRowView"
Here is what I did:

private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
this->oleDbDataAdapter1->SelectCommand->CommandText="SELECT DISTINCT Profile_Name FROM Profiles";
this->oleDbDataAdapter1->Fill(dataSet1,"Profiles");
DataTable^dt= dataSet1->Tables["Profiles"];
checkedListBox1->DataSource= dt;
checkedListBox1->DisplayMember = "Profile_Name";
checkedListBox1->ValueMember="Profile_Name";
			 }

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
 for ( int i = 0; i < checkedListBox1->CheckedItems->Count; i++ )
 {
  listBox1->Items->Add(checkedListBox1->CheckedItems[i]->ToString());
 }

What I am getting is just "System.Data.DataRowView", I looked through many website but still unable to solve the problem...Can any pro fren lend me a helping hand?

Thanks in advance.

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by mitrmkar
0

The following should work ...

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
for ( int i = 0; i < checkedListBox1->CheckedItems->Count; i++ )
{
    listBox1->Items->Add
    (
	checkedListBox1->[B]GetItemText[/B](checkedListBox1->CheckedItems[i])
    );
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.