【发布时间】:2011-07-18 09:49:38
【问题描述】:
我有一个由复选框、单选按钮和 dateTimePicker 组成的网络表单。
所有选项都适用于表单,但是我需要以某种方式获取所有用户输入,例如当有人选中“checkBox1”以保存到文本文件时。我不确定如何在 C# 中执行此操作。
到目前为止,我有 -
string path = "path";
try
{
if (File.Exists(path))
{
File.Delete(path);
}
using (FileStream fs = File.Create(path))
{
Byte[] info = new UTF8Encoding(true).GetBytes("");
// Add some information to the file.
fs.Write(info, 0, info.Length);
我可以让文件写出每个特定的复选框名称,但我希望能够只写出已选中的复选框。
我认为它会像 - if checkbox1.checkedstate = true
非常感谢任何帮助。
【问题讨论】:
-
你能澄清你的问题吗?