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.

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])
    );
}
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.