且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在DataGridView中读取大量XML文件和组值

更新时间:2023-11-13 16:56:46

对不起我对你的问题不是很清楚,如果你想搜索的话文件夹中的所有XML文件,然后

Directory.GetFiles()
函数有一个重载,它接受要包含在搜索中的文件类型的过滤器,因此您可以轻松使用"*。xml"。仅搜索XML文件:

Sorry I'm not very clear for your question, if you want to search all of the XML files in the folder, then the Directory.GetFiles() function has an overload which accepts filters for the type of files to include in the search, so you can easily use "*.xml" to search for only XML files:

    FolderBrowserDialog folderDlg = new FolderBrowserDialog();
    DialogResult result = folderDlg.ShowDialog();

    if (result == DialogResult.OK)
    {
        string[] files = Directory.GetFiles(folderDlg.SelectedPath, "*.xml");
        //...
    }

另请参阅以下类似主题:

Also please refer to the following similar thread:

如何加载从文件夹到XmlDocument的所有Xml文件

如果要将XML加载到datagridview,请参考以下内容:

If you want to load the XML to datagridview, please refer to these:

加载XML文件使用C#进入DataGridView

如何在WinForms项目中将XML用作DataGridView的数据源?

以任何方式将项目从xml填充到Datagridview使用c#

问候,

Frankie