在vb.net中显示xml文件 [英] Display xml file in vb.net

查看:129
本文介绍了在vb.net中显示xml文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,显示的代码是:



 Imports System.Xml 

Imports System.Data

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles Button1.Click

Dim xmlFile As XmlReader

xmlFile = XmlReader.Create(Product.xml,New XmlReaderSettings())

Dim ds As New DataSet

ds.ReadXml (xmlFile)

DataGridView1.DataSource = ds.Tables(0)

End Sub

End Class





问题是它只显示表,如何显示表中的所有数据?

解决方案

< blockquote>如果绑定到数据集,则可以查看所有数据:

 DataGridView1.DataSource = ds 


hello, the code displayed is :

Imports System.Xml

Imports System.Data

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim xmlFile As XmlReader

        xmlFile = XmlReader.Create("Product.xml", New XmlReaderSettings())

        Dim ds As New DataSet

        ds.ReadXml(xmlFile)

        DataGridView1.DataSource = ds.Tables(0)

    End Sub

End Class



The problem is that it is only displaying the table , how to display all data within the table??

解决方案

You can view all the data if you bind to the dataset:

DataGridView1.DataSource = ds


这篇关于在vb.net中显示xml文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆