locked
Display data From XML File to DataGrid Control ?

    Question

  • Hello all,

    i'm new on .net.
    How to display(Read data) from file XML To DataGrid File ?

    Tuesday, January 16, 2007 9:42 AM

Answers

  • Yusuf Hermanto,

    Since your code are running on Pocket PC application, I find an article titled How to: Use the DataGrid on the Pocket PC that demonstrates techniques for using the DataGrid control with forms for viewing and editing a record selected in the DataGrid control, and adding a new record to the database. Note that a user interface (UI) must be provided to edit DataGrid values, because editing the DataGrid cells is not supported in the .NET Compact Framework. This example uses the Northwind database, installed with Microsoft Visual Studio 2005.

    The DataGrid class is the .NET Compact Framework version of the control. You must add a reference to System.Windows.Forms.DataGrid.dll in your project to use it.

    http://msdn2.microsoft.com/en-us/library/ms229684(VS.80).aspx

     

    Wednesday, January 31, 2007 3:06 AM

All replies

  • Yusuf Hermanto,

    Use the XMLTextReader class inherited from System.xml namdspace and referenced as the following link:

    http://msdn2.microsoft.com/en-us/library/system.xml.xmltextreader.aspx

    Here I will give a code example in on of my project with a sub procedure WXReadXML:

        Private Sub WXReadXML(ByVal fileName As String)

            Dim readOfficeInfo As Xml.XmlTextReader

            readOfficeInfo = New Xml.XmlTextReader(fileName)

            While readOfficeInfo.Read()

                WXShowXMLNode(readOfficeInfo)

                While readOfficeInfo.MoveToNextAttribute()

                    WXShowXMLNode(readOfficeInfo)

                End While

            End While

            readOfficeInfo.Close()

        End Sub

     

    If you need the WXShowXMLNode sub code, please reply me and I hope this example helps you.

    Tuesday, January 23, 2007 3:29 AM
  • Thanks for your answer.

    But i want to run my program on the pocket PC Application not on dekstop application.

    i founds the problem about the file directory ?

    what is your code can be run on Pocket PC Application ??
    Wednesday, January 24, 2007 3:39 AM
  • Yusuf Hermanto,

    Since your code are running on Pocket PC application, I find an article titled How to: Use the DataGrid on the Pocket PC that demonstrates techniques for using the DataGrid control with forms for viewing and editing a record selected in the DataGrid control, and adding a new record to the database. Note that a user interface (UI) must be provided to edit DataGrid values, because editing the DataGrid cells is not supported in the .NET Compact Framework. This example uses the Northwind database, installed with Microsoft Visual Studio 2005.

    The DataGrid class is the .NET Compact Framework version of the control. You must add a reference to System.Windows.Forms.DataGrid.dll in your project to use it.

    http://msdn2.microsoft.com/en-us/library/ms229684(VS.80).aspx

     

    Wednesday, January 31, 2007 3:06 AM