• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 220
  • Last Modified:

Datagrid Question

Hi,

I'm returing a dataset from a webservice to a Datagrid using:

        dsOut.ReadXml(stream)
        DataGrid1.DataSource = dsOut

When the grid populates, I see one item called "item" with a plus sign, expanding this gives me the data I want, how do avoid the initial item being displayed and automatically expand to "item"

Regards
Plucka
0
Plucka
Asked:
Plucka
  • 2
  • 2
1 Solution
 
rrbeckerCommented:
Hi Plucka,

What about trying to load all 'Child Nodes'

example: DataGrid1.DataSource = dsOut.childNodes(1)

Actually you may have to iterate through the XML and load the data from there:

example:
---------------------------------------------------------------------------------
For I = 0 To ResultDocument.childNodes.Length - 1
        If ResultDocument.childNodes(I).hasChildNodes = True Then
            RtnVal = LoadXMLChildNode(ResultDocument.childNodes(I), CStr(ResultDocument.NodeName))
        Else
            XMLNodeNameArray(MaxXMLNodes) = CStr(ResultDocument.NodeName)
            XMLNodeValueArray(MaxXMLNodes) = CStr(ResultDocument.childNodes(I).Text)

            MaxXMLNodes = MaxXMLNodes + 1
            ReDim Preserve XMLNodeValueArray(MaxXMLNodes)
            ReDim Preserve XMLNodeNameArray(MaxXMLNodes)

        End If
    Next I
-----------------------------------------------------------------------------

This is just a snippet from something that I have used in the past. It is not intended to be anything more than just some food for thought.....


Hope this helps a little

rrbecker
0
 
PluckaAuthor Commented:
Ahh,

Yes good food, did make me think about specifying the node on the dataset.

This works.

DataGrid1.DataSource = dsOut.childNodes(1).Tables(0)

Regards
Plucka
0
 
PluckaAuthor Commented:
Sorry,

I mean this.

DataGrid1.DataSource = dsOut.Tables(0)

Regards
Plucka
0
 
rrbeckerCommented:
Hi Plucka,

Glad I could help. I have received plenty of help from EE myself. I am glad that I could return the favor.

Thanks, and have 'Fun'....


rrbecker
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now