您好我有一个Xml文件,我可以反序列化。
<datatransfer>
<start>
<msgdate>20140416</msgdate>
<msgtime>112857</msgtime>
</start>
<details>
<ref>test3</ref>
<accountref>ABC01</accountref>
<accountfrom />
<accepted>Y</accepted>
<requesteddate>20140418</requesteddate>
<requestedtime>210000</requestedtime>
</details>
<end>
<nbr>1</nbr>
</end>
</datatransfer>
我使用以下代码进行反序列化
Public Shared Function LoadFromXMLBookingConfirmation(Folder As String)
Try
Dim Samples As New List(Of datatransfer)
Dim Files As String() = Directory.GetFiles(Folder) ' File where the Booking confirmation is stored.
For Each fl In Files
'Deserialize XML file
Dim objStreamReader As New StreamReader(fl)
Dim i As New datatransfer
Dim x As New XmlSerializer(i.GetType)
i = x.Deserialize(objStreamReader)
Samples.Add(i)
objStreamReader.Close()
Next
Return Samples
样本中存储了Xml中的所有内容,但是当我将其放入数据网格视图中时,我只是得到标题&#34;开始,详细信息并结束&#34;在每一个下面我都有test.start,test.details和test.end。
以下是我用于将数据放入datagridview的代码。
DataGridView1.DataSource = test.ControllerClass.LoadFromXMLBookingConfirmation("c:\ftptest\Booking Confirmation")
如何在datagridview中显示所有数据?