How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask Ingo U Your Own Question
Ingo U
Ingo U, Software Engineer
Category: Programming
Satisfied Customers: 755
Experience:  Over 25 years experience in software development. Expert in Microsoft .Net, C#, C++, VB, SQL
44076068
Type Your Programming Question Here...
Ingo U is online now
A new question is answered every 9 seconds

Im working with windows forms in c#. I have a xml file im

Customer Question

Im working with windows forms in c#. I have a xml file im trying to load into a datagridview which is not in the standard xml format. I want the information to be editable then I need to save it out in the same format. How can I just show the important piece of information when editing? eg Name, DOB
here is xml







Submitted: 1 year ago.
Category: Programming
Expert:  Ingo U replied 1 year ago.

Hi

Can you upload your files so I may have a,look?

Customer: replied 1 year ago.

Sorry it didnt copy and paste

<?xml version="1.0" encoding="utf-8"?>
<ExampleObjectContainer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Objects>
<ExampleObject Name="John Doe" DOB="1970-01-02T00:00:00" NumberOfWidgets="123" />
<ExampleObject Name="Jane Doe" DOB="1980-03-04T00:00:00" NumberOfWidgets="345" />
<ExampleObject Name="Jack Doe" DOB="1985-04-05T00:00:00" NumberOfWidgets="12" />
</Objects>
</ExampleObjectContainer>

Customer: replied 1 year ago.
Expert:  Ingo U replied 1 year ago.

Can you put your files in a zip folder and attach it here with the paper clip? Or use wikisend?

Expert:  Ingo U replied 1 year ago.

Also the c# ***** you're working on

Customer: replied 1 year ago.

it only lets me upload images with the paper clip

here is the xml file

http://wikisend.com/download/637052/kurchekdata.xml

Customer: replied 1 year ago.

I havent gotten far, im trying to figure out how to work with the xml file i have. http://wikisend.com/download/175168/Form1.cs

Customer: replied 1 year ago.

This is what i need to do with the xml file. I was going to use a datagridview for the table. How can I change the xml so it just has the important information in the table?

Create a GUI using Windows Forms that does the following:

1. Read in an XML file

2. Display the contents of the file in a table

3. Allow the user to add/edit/remove the file’s contents

4. Allow the user to save the file back out in the same XML format

Customer: replied 1 year ago.

How much more time do you need to reply?

Customer: replied 1 year ago.
Relist: Other.
I was asked for more information, after I sent it I received no answer.
Expert:  Ingo U replied 1 year ago.

I'm reviewing your files now.

Expert:  Ingo U replied 1 year ago.

What version of Visual Studio do you use?

Expert:  Ingo U replied 1 year ago.

Why did you mention "not in the standard xml format" in your original question?
The XML file looks normal enough to me...

Customer: replied 1 year ago.

visual studio community 2015

it is standard, i was mistaken. im not so familiar with xml.

Expert:  Ingo U replied 1 year ago.

Here's a simple demo app to show you how it can be done.

http://dl.dropbox.com/u/7895834/XmlDataGridDemo.zip?dl=0

Be sure to unzip to a folder on your disk before opening with VS2015

Your XML is a little "unusual" for this purpose because it has an extra level of nesting:
"ExampleObjectContainer" contains a single "Objects" which contains individual "ExampleObjects".

The DatagridView seems to be able to figure it out, but if you have any control over the XML file,

I would eliminate one of the outer containers, at least for clarity. If your application becomes more involved, there may be other issues to necessitate it.

Hope that helps!

-Ingo U