在C#Windows窗体上保存/加载输入? [英] Save/Load inputs on C# windows form?

查看:86
本文介绍了在C#Windows窗体上保存/加载输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了一个基于C#表单的应用程序.它由多个文本框和几个单选按钮组成.如果我想为此应用程序创建自己的唯一文件类型(例如-* .ct),我该怎么做?我想要实现的是使用户能够进行文件保存-然后它将保存一个* .ct文件,这将是他们在文本框中输入的信息以及他们选择的单选按钮.然后,当他们运行应用程序时,我想有一个选项-文件->打开,他们可以打开* .ct文件,然后将其填满复选框并选择他们选择的单选按钮.如果有人可以指出我的代码链接,使他们看到这样做的地方,等等,或者粘贴我可以从中使用的任何示例,那将是很大的帮助.

I have developed a C# form based application. It consists of a number of text boxes and a few radio buttons. If i want to create my own unique file type for this application (e.g - *.ct) how would i go about doing that? What I want to achieve is for the user to be able to go to file save - it will then save a *.ct file which will be the info they have entered into the text boxes and the radio buttons they have chosen. I would then like to have an option when they run the application - File -> Open and they could open the *.ct file and then that would fill the checkboxes and select the radio buttons they have chosen. if anyone can point me out any links to code where they have seen this done, etc or paste up any examples i can work from that would be a great help.

谢谢.

推荐答案

我建议您宁愿将文件另存为XML,然后在读取xml文件时,可以验证其架构以确定您的应用程序是否可以读取它.

I would suggest you rather save the file as XML, then when you read the xml file you can validate it's schema to determine if the your application can read it.

Xml文件是存储信息时的标准.这也使您的应用程序可以在将来的某个日期使用标准格式在另一个应用程序之间进行通信.哪些是xml文件.

Xml Files is a standard when it comes to store information. This also allows your application to maybe at a future date communitcate between another application using a standard format. Which are xml files.

这篇关于在C#Windows窗体上保存/加载输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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