用于填充新数据的空文本文件 [英] Empty text file to fill with new data

查看:42
本文介绍了用于填充新数据的空文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



现在我能够逐行读取文本文件,直到行尾。代码是



Hi all,

Right now I''m able to read the textfile line by line until end of line..here are the code

Dim Reader As StreamReader = File.OpenText("C:\Test.txt")
Dim FileText As String = Reader.ReadToEnd()
Reader.Close()
txtTest.Text = FileText





读完所有行后,用户能够编辑该行并保存新数据。但是,如何在写入新数据之前清理文本文件的内容?我尝试在谷歌搜索但没有找到正确的解决方案。那么有人可以帮我吗?

我不想删除文件并创建新文件。我想使用当前的文本文件,你知道我的意思。请告诉我这个



after it read all line, user able to edit the line and save the new data. But how can I clean the content of the textfile before I write the new data on it? I try to search on google but not find the right solution. So could someone help me on this?
I dont want to delete the file and create new one. I want to use the current textfile and..you know what I mean. Please advise me on this

推荐答案

看这里: http://msdn.microsoft.com/en-us/library/system.io.streamwriter.aspx [ ^ ]。



现在,找到建设者部分。查看构造函数的帮助页面,但只查看具有布尔参数的页面。在任何这些页面中阅读此参数。此参数是您的解决方案。



-SA


这篇关于用于填充新数据的空文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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