1 Replies - 1049 Views - Last Post: 09 January 2012 - 03:21 PM Rate Topic: -----

#1 jone kim   User is online

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 61
  • Joined: 07-January 10

data grid view of xml file in C# form application

Posted 09 January 2012 - 03:18 PM

<?xml version="1.0" encoding="utf-8" ?>
<phonebook>

  <phone-number category = "family_relatives">
    
    <name> cathy </name>
    <number type = "vodafone"> 2356801</number>
    
  </phone-number>

  <phone-number category = "office">
    
    <name>MAPLE </name>
    <number>051235 </number>
    <address> MCIOEJAERJ</address>

  </phone-number>

  
  <phone-number category="peers">
    
    <name>15vregtre </name>
    <number>23154632165 </number>
    <address>klgirmfgj </address>
    <designation>klirglkfg </designation>

  </phone-number>

</phonebook>



************************
How to view this xml file via data grid view in C# form application?
I did it in the way:
****************************
DataSet ds=new DataSet();
ds.ReadXml("PhoneBookDirectory.xml");
datagridview1.DataSource=ds.Tables(0);


************************
ERROR:
the name datagridview1 does not exist in the current context
Non-invocable member 'System.Data.DataSet.Tables' cannot be used like a method.

************************
ds.ReadXml("Yourfilepath");
ds.ReadXml("E:\projects\xml\practice\PhoneBook\PhoneBook\PhoneBookDirectory.xml");  


when I copied the full path from the xml file, it shows the error:
Unrecognized escape sequence
**********************************
What is the problem?

Is This A Good Question/Topic? 0
  • +

Replies To: data grid view of xml file in C# form application

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15781
  • View blog
  • Posts: 63,252
  • Joined: 12-June 08

Re: data grid view of xml file in C# form application

Posted 09 January 2012 - 03:21 PM

Let's not create duplicate topics, champ!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1