1
Answer

CheckedListBox and System.Data.DataRowView

Yogesh Paul

Yogesh Paul

16y
14.2k
1
Hi All

I am writing an application in C# where I have to write checked items from an CheckedListBox into an XML file and for that I am storing checked items in an ArrayList.

The problem I face is that , if I check 5 items , then 5 items are stored in XML file but all  having text as "System.Data.DataRowView"

Can someone please help me out as to how to resolve this ? Here is the code snippet from my program.....

// Populating the checked list box with data from a dataset. table name is variable and
//column name is NAME
ckdListBox.DataSource = thisDataSet.Tables["variable"];
ckdListBox.DisplayMember = "NAME";
ckdListBox.ValueMember = "NAME";
ckdListBox.SelectedIndex = 0;

//code for extracting checked items
if (this.ckdListBox.CheckedItems.Count > 0)
{
         // Loop through the CheckedItems collection of the CheckedListBox
         // and add the items in the arrayList
          for (int count = 0; count < this.ckdListBox.CheckedItems.Count; count++)
          {
                  selectedTags.Add(this.ckdListBox.CheckedItems[count].ToString());
          }
}

Answers (1)