vb io读写

前端之家收集整理的这篇文章主要介绍了vb io读写前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

简写代码

写入:

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


读取文件时 根据数据头判断取出的数据 原文链接:https://www.f2er.com/vb/258948.html

猜你在找的VB相关文章