Solved

Load all XML file elements into a dropdownlist

Posted on 2007-11-29
3
912 Views
Last Modified: 2013-11-26
Hi,

I have a XML file that I want to load all the child elements into a Dropdownlist. Can I do that and how?

If there are more than one of the same child elements I only want to only show one.

Thanks
0
Comment
Question by:ALawrence007
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
vbturbo earned 500 total points
ID: 20376562
Hi this will read a xml file and only populate the atribute CustName into your combo

      Dim testing As New DataSet

        testing.ReadXml("C:\SomeFolder\SomeXMLfile.xml")
       MyCombo.DataSource = testing.Tables(0)
       MyCombo.DisplayMember = "CustName" 'The value to be shown in the list.
       MyCombo.ValueMember = "CustName" 'The value that will return the SelectedValue property of the currently
       selected item.  

vbturbo
0
 

Author Comment

by:ALawrence007
ID: 20382264
vbTurbo,

Thanks for that reply. I worked on this last night and keep on getting the following error:
Cannot add a SimpleContent column to a table containing element columns or nested relations

Any I deas?
0
 
LVL 18

Assisted Solution

by:vbturbo
vbturbo earned 500 total points
ID: 20417907
Do you have any table relations in your dataset ?

testing.Relations.Clear()

else try paste some code

vbturbo
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question