Display XML file to a Datagrid?

  • Thread starter Thread starter Guest
  • Start date Start date
Hi,

Try something like this.

Dim ds As New DataSet

ds.ReadXml("C:\temp.xml")

DataGrid1.DataSource = ds.Tables(0)



Ken

-----------------------------

Hello,

Is it possible to display an existing xml file in a datagrid?

Thanks
 
Ish,

That depends of that XML file is a dataset (Or has the same format, that is
easy to see, when there are attributes it is not a normal dataset has only
elements).

Cor
 
Funny sentence, it can be readed as I not intended.
That depends of that XML file is a dataset (Or has the same format, that
is easy to see, when there are attributes it is not a normal dataset has
only elements).

when there are attributes it is not. A normal dataset has only elements.
 
Hi Cor,

I really don't get what you are trying to say. I am very new to the .Net
environment.

Ish....
 
Hi Ken,

Thanks for you prompt reply, how would i display the same xml file is a
textbox?

Thanks....
 
Ish,

Telling that a file is a xml file is says not much, the way that it is used
tells more.

One of the formats is the dataset. When the code from Ken shows your XML
file in a datagrid than it is a dataset.

Than you can use databinding.

textbox1.DataBindings.Add(New Binding("Text", dataset1.Tables(0),
"LastName"))

I hope this helps?

Cor
 
Hi,

Try something like this.

With TextBox1

..Text = ds.GetXml

..Multiline = True

..ScrollBars = ScrollBars.Both

..Height = 200

End With



Ken

--------------------------------

Hi Ken,

Thanks for you prompt reply, how would i display the same xml file is a
textbox?

Thanks....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top