Solved

Load all XML file elements into a dropdownlist

Posted on 2007-11-29
3
910 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

744 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now