Getting Xml into datagrid...

  • Thread starter Thread starter Dave Brown
  • Start date Start date
D

Dave Brown

Hi all, i'm trying to setup a datagrid from a set of xml data I load and am
having difficulties deciding A. if its possible to do what i want to do and
B. how to attempt it.
this is an example of the XML,
<items>
- <item>
<Itemid>0001000002</Itemid>
<Quantity>0</Quantity>
<Description>GRENADE LAUNCHER</Description>
<Latitude Dir="N">40.929318617</Latitude>
<Longitude Dir="W">-74.578571746</Longitude>
<shape name="MINE.GIF" width="0" height="0">0001000002</shape>
<SoundCount>1</SoundCount>
<ImageCount>2</ImageCount>
</item>

the first problem i'm getting is if I bind the xml document directly to the
datagrid I end up with the a rather ugly display, with little plus's i have
to click on, for each node that has attributes.
for the shape node, i want to load the image specified and display it and
not show the name, width or height attributes.
and for the soundcount and imagecount nodes, I want to display buttons that
have captions relevant to the node data, e.g. 1 Sound, or "2 Images". then
the user will click on the button and i will give them a list of
sounds/images they can view/hear.

If anyone can shed any light on this I would be sooo gratefull as I'm
getting completely lost in the object model looking at
datasets/xml/datagrids and its looking like its not possible to do some of
things i'd like.

rgds,.

dave.
 
Hi,

Load the xml into a dataset. Add a tablestyle to the grid to format
the data.

http://msdn.microsoft.com/library/d...l/frlrfSystemDataDataSetClassReadXmlTopic.asp

http://msdn.microsoft.com/library/d...sualbasicprimer.aspKen-----------------------"Dave Brown" <dave.AT.dbws.net> wrote in messageHi all, i'm trying to setup a datagrid from a set of xml data I load andam> having difficulties deciding A. if its possible to do what i want to doand> B. how to attempt it.> this is an example of the XML,> <items>> - <item>> <Itemid>0001000002</Itemid>> <Quantity>0</Quantity>> <Description>GRENADE LAUNCHER</Description>> <Latitude Dir="N">40.929318617</Latitude>> <Longitude Dir="W">-74.578571746</Longitude>> <shape name="MINE.GIF" width="0" height="0">0001000002</shape>> <SoundCount>1</SoundCount>> <ImageCount>2</ImageCount>> </item>>> the first problem i'm getting is if I bind the xml document directly tothe> datagrid I end up with the a rather ugly display, with little plus's ihave> to click on, for each node that has attributes.> for the shape node, i want to load the image specified and display it and> not show the name, width or height attributes.> and for the soundcount and imagecount nodes, I want to display buttonsthat> have captions relevant to the node data, e.g. 1 Sound, or "2 Images".then> the user will click on the button and i will give them a list of> sounds/images they can view/hear.>> If anyone can shed any light on this I would be sooo gratefull as I'm> getting completely lost in the object model looking at> datasets/xml/datagrids and its looking like its not possible to do some of> things i'd like.>> rgds,.>> dave.>>
 
This is easily done,

SIMPLE EXAMPLE:
Dim objDataSet As New DataSet

objDataSet.ReadXml("yourxmlfile")

dataMembers.DataSource = objDataSet.Tables(yourtable)

dataMembers.Refresh()

Luck!

Sincerely,
Daniel
 
Back
Top