This is a comment thread discussing XBrowse
  • 12 years ago

    I modified the code to accept an XML string instead of opening a file.


    Public Message As String

    Public Sub LoadXML()

    Dim d As New DataSet() 'Dim local dataset object for this method


    Dim XmlDataDocument As New XmlDataDocument

    XmlDataDocument.DataSet.ReadXml(New IO.StringReader(Message))

    d = XmlDataDocument.DataSet.Copy

    dg1.DataSource = d ' bind datagrid control to the local dataset object

    Catch exp As Exception ' catch any exceptions that may get thrown and display in messagebox

    MessageBox.Show(exp.Message.ToString, "Exception was caught", MessageBoxButtons.OK, MessageBoxIcon.Error)

    End Try

    ds = d.Copy 'copy local dataset object up to global dataset for persistance

    dg1.DataSource = ds 'reset datagrid datasource property to global dataset object

    dg1.Refresh() 'refresh datagrid

    dg1.Collapse(-1) 'collapse datagrid to get back to root node

    d.Dispose() ' dispose of local dataset object

    End Sub

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice: Nothing works and they don't know why.”