[英]How to save text from text box in text file?
I have 3 text boxes and one button. 我有3个文本框和一个按钮。 On button click all text from text boxes should be written in text file (in one line).
在按钮上单击,来自文本框的所有文本都应写在文本文件中(一行)。 How can i do that?
我怎样才能做到这一点?
Direct implementation: 直接执行:
File.WriteAllText(dest,
tbID.Text + tbIme.Text + tbPrezime.Text);
You can have all textboxes in a List<TextBox>
and at the time of writing do: 您可以将所有文本框都放在
List<TextBox>
,在编写本文时,请执行以下操作:
list.ForEach(tb => file.Write(tb.Text));
file.WriteLine();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.