将数据从listview导出到XML [英] Exporting data from my listview to XML

查看:74
本文介绍了将数据从listview导出到XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述







我正在用wpf(VB.NET)为学校项目做一个应用程序。 />
老实说,我对VB.NET中的编程并不那么聪明。我的应用程序的目标是将listview的项目导出到存档XML。到目前为止,上帝,我无法做到,因为我是这种语言的新手。你能解释一下我如何从列表视图中导出数据吗?如果你有时间,你可以解释我如何导入数据到我的listview。这个应用程序对我来说非常重要。

谢谢。

Hi,


I'm doing an application in wpf (VB.NET) for a project of school.
Honestly i'm not so smart with the programmation in VB.NET. The goal of my application is export the items of my listview to the archive XML. So far so god, I have not been able to do because i'm new in this language. Could you explain me how i can export data from my listview please? if you have a time, you can explain me how import data to my listview. This application is very important to me.
Thank you.

推荐答案

public static bool ExportXml(DataSet ds)
{
    bool result = false;
    SaveFileDialog sfd = new SaveFileDialog();
    sfd.FileName = DateTime.Now.ToString("yyyyMMddHHmmss");
    sfd.Filter = "xml file(*.xml)|*.xml";
    sfd.AddExtension = true;
    if (sfd.ShowDialog() == DialogResult.OK)
    {
        try
        {
            ds.WriteXml(sfd.FileName);
            result = true;
        }
        catch
        {
            result = false;
        }
    }
    return result;
}


这篇关于将数据从listview导出到XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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