简写代码
写入:
Imports System.IO.File
Dim disco As System.IO.File
Dim scrivi As System.IO.StreamWriter
scrivi=disco.AppendText("c:\data.txt")
scrivi.WriteLine(TextBox1.Text)
scrivi.WriteLine(TextBox2.Text)
scrivi.WriteLine(TextBox3.Text)
scrivi.WriteLine(TextBox4.Text)
scrivi.Close()
读出:
Imports System.IO.File
Dim disco As System.IO.File
Dim leggi As System.IO.StreamReader
Dim riga As String
leggi=disco.OpenText("c:\data.txt")
if textBox1.text ="" then msgBox("not data")
While leggi.Peek <> -1
riga=leggi.ReadLine()
if riga=TextBox1.text then exit while
end while
textBox2.text=leggi.Readline()
textBox3.text=leggi.Readline()
textBox4.text=leggi.Readline()
写入的文本数据:
01/01/2013 ‘数据头
hello
2
email.com
01/02/2013 ‘数据头
zxl
1
163.com