Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 28th, 2007, 12:48 PM
Authorized User
 
Join Date: Feb 2005
Posts: 47
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Thank you dparsons,

Okay now it is saying that I can't bind to feedsXml. Basically I am getting an ArgumentException where I am setting the comboBox's DataSource saying that I can't do complex binding without an IList or IListSource. I am beginning to think that I am asking VC# to do the impossible. Any suggestions?

Thanks
Chris

 
Old August 29th, 2007, 01:54 AM
Authorized User
 
Join Date: Feb 2005
Posts: 47
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Hi all,

I have figured out the problem. I just needed to put the following code in the frmMain_Load event. Here is the code that works.
Code:
private void frmMain_Load(object sender, EventArgs e)
{
    DataSet dsFeeds = new DataSet();
    dsFeeds.ReadXml("Feeds.xml", XmlReadMode.InferSchema);

    cboFeeds.DataSource = dsFeeds.Tables["Feed"];
    cboFeeds.DisplayMember = "feedName";
    cboFeeds.ValueMember = "feedLocation";
}
And here is how the XML file is laid out.
Code:
<?xml version="1.0"?>
<Feeds>
    <Feed>
       <feedName></feedName>
       <feedLocation></feedLocation>
    </Feed>
    <Feed>
       <feedName></feedName>
       <feedLocation></feedLocation>
    </Feed>
</Feeds>
I tested it and it works. Sweetness. Thank you all for your help.

Thanks
Chris






Similar Threads
Thread Thread Starter Forum Replies Last Post
filling the combobox using sql data adapter kumaran BOOK: Professional .NET 2.0 Generics 4 October 5th, 2015 07:57 AM
Filling ComboBox from Dataset dcathers C# 9 June 15th, 2013 03:31 AM
Filling a combobox/listbox unmeshraut VB How-To 1 September 21st, 2007 12:08 PM
Filling SubForm from ComboBox ayazhoda Access VBA 4 June 5th, 2007 10:56 AM
Filling Combobox with value from other Combobox ayazhoda Access VBA 6 June 5th, 2007 04:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.