Hello Everyone,

Im trying to read an item from combobox. but somehow i getting "system.Data.DataRowView" this only. here is my code

            DataSet ds = new DataSet();
            ds.ReadXml(AppDomain.CurrentDomain.BaseDirectory+ "\\MYFiles\\Books.xml");

            CmbXmlbooks.DisplayMember = "BName";
            CmbXmlbooks.ValueMember = "Isbn";
             CmbXmlbooks.DataSource = ds.Tables[0];

             //Im reading the data from a xml file

private void CmbXmlbooks_SelectedIndexChanged(object sender, EventArgs e)
    {
        LstXmlBooks.Items.Add(CmbXmlbooks.SelectedItem.ToString());
    }

can anyone help to fix this problem

It should work like this:
you nead to change "NameOfCollum" with your collumn name, or you can use index of collumn..

private void CmbXmlbooks_SelectedIndexChanged(object sender, EventArgs e)
{
    DataRowView d = (DataRowView)CmbXmlbooks.SelectedItem;
    LstXmlBooks.Items.Add(d["NameOfCollum"].ToString());
}

for basic programming commands you can make a look to: http://ctp.mkprog.com/en/

commented: Good site tip +15
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.