关于TXT读写的问题?

来源:百度知道 编辑:UC知道 时间:2024/07/05 06:56:11
怎样在一个TXT文件的字海中找到...某行中的第N个字?将其显示在文本框中..给予修改......然后按确定....另存为....以该修改内容为文件夹名的文件夹中.............

例如: 在D盘有一TXT文件"123.txt"
在"123.txt"中的11行中的第11到第13个字为"我爱你"... ..
要想将其显示到文本框中,给予手动修改....
或,不用显示,直接将其修改...另存为与其修改内容为名的文件夹中......改如何操作?
麻烦代码中,标明作用
如果可以....做个样板发给我
fly1987abc@hotmail.com

Private Sub Command1_Click() '保存
Dim cc As String
CommonDialog1.ShowSave
cc = CommonDialog1.FileName
If cc <> "" Then
Open cc For Output As #1
Print #1, UCase(Text5.Text)
Close #1
End If
End Sub
Private Sub Command2_Click() '恢复
Dim i As Integer
Dim TextLine As String
Dim cc As String
CommonDialog1.Filter = "Text (*.txt)|*.txt"
CommonDialog1.ShowOpen
cc = CommonDialog1.FileName
If cc <> "" Then
Text3.Text = ""
Open cc For Input As #1
Do While Not EOF(1)
i = i + 1
Line Input #1, TextLine
Text3.Text = Text3.Text + Trim(TextLine) & vbNewLine
Loop