从文本框到文本文件的Readline? [英] Readline from textbox to textfile ?

查看:108
本文介绍了从文本框到文本文件的Readline?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好..

忘记我的其他问题,这是一个新问题.

我的VCard文件:

Hello..

forget about my other questions, here is a new one.

my VCard file:

BEGIN:VCARD
VERSION:2.1
N:Voornaam;Naam
FN:Naam Voornaam
TEL;WORK;VOICE:0636345752
TEL;WORK;VOICE:0636345752
TEL;HOME;VOICE:0512540221
TEL;CELL;VOICE:0611299731
TEL;VOICE:0512540221
TEL;WORK;FAX:Fax
TEL;FAX:Mobiel
ADR;WORK;ENCODING=QUOTED-PRINTABLE:Sjoerd Veltmanstraat 15=0D=0A=
9203 NJ  Drachten
ADR;HOME:;;;;;;Nederland
ADR;POSTAL:;;;;;;Nederland
X-MS-OL-DEFAULT-POSTAL-ADDRESS:2
URL;HOME:Website
URL;WORK:www.mmportretstudio.nl
EMAIL;PREF;INTERNET:onnedejong@gmail.com
END:VCARD




我的表单上有10个文本框..一个用于"Naam","Voornaam"等.
现在我想一一阅读文本框..并将信息写入到我想另存为* .vcf.
的文本文件中 我谁都知道我该如何使用读写方法???

感谢




I have 10 textboxes on my form.. one for "Naam", "Voornaam",.. etc etc.
Now i want to read the textboxes one by one.. and write the info to a textfile that i want to save as *.vcf.
I any one know how i can use the read and write methode???

thanks

推荐答案

您可以简单地使用StringBuilder创建文件内容(通过文本框控件)并将其写入文件.看一下msdn上的示例:
http://msdn.microsoft.com/en-us/library/6ka1wd3w.aspx [ ^ ]
You can simply use a StringBuilder to create the file content (from the textbox controls) and write them to a file. Have a look at the example at msdn:
http://msdn.microsoft.com/en-us/library/6ka1wd3w.aspx[^]
// Fill StringBuilder using AppendLine for all the items you want to add:
StringBuilder sb = new StringBuilder();
sb.AppendLine(txtName.ToString());
sb.AppendLine(txtPhone.ToString());
sb.AppendLine(txtEmail.ToString());

// write to file
using (StreamWriter outfile = new StreamWriter(@"test.vcf"))
{
    outfile.Write(sb.ToString());
}


祝你好运!


Good luck!


使用System.IO.File命名空间.例如:
Use the System.IO.File namespace. For example:
System.IO.File.WriteAllLines()


我已经用我发布的最新代码亲自解决了这个问题.表格.
I have solved this problem by myself with the last code I have posted on the form.


这篇关于从文本框到文本文件的Readline?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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