Note: I mainly refer to the previous article "VB and VB. NET XML operations" Article url: http://www.wrclub.net/study/listarticle.aspx? Id = 1459
This section describes the general process. However, in my actual application process
In the article code:
Dim mySDD As System. Xml. XmlDataDocument
MyXDD = New System. Xml. XmlDataDocument (Me. dsMaster1)
MyXDD. Load ("dataOnly. xml ")
SetBindings (Me. dsMaster1)
The SetBindings method never knows what it is and cannot be found in msdn, so it is still not implemented according to the method in his article. I have referred to msdn, but this article is still very helpful to me, although it also led to some detours.
Here we mainly post two events to load xml into the datagrid:
'If ds is used directly as the datasource, The datagrid is not expanded. If dv is used, the result is displayed correctly.
Dim ds As DataSet = New DataSet
Ds. ReadXml (xmlFile)
Dim tb As DataTable
Dim dv As DataView
Tb = ds. Tables (0)
Dv = New DataView (tb)
'Maid. DataSource = dv
'Maid. DataMember = "testXmlMember"
'Maid. DataMember = "employeefname"
'Dim dxd As New XmlDataDocument
DataGrid1.SetDataBinding (dv ,"")