vb.net
输入 学生 考号:姓名:班级:成绩:插入到文本存储库中 读取文本中的信息
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button1.Click Dim xh,bj,sname As String Dim mark As Double FileOpen(1,"d:\data.txt",OpenMode.Append) xh = TextBox1.Text sname = TextBox2.Text bj = TextBox3.Text mark = TextBox4.Text WriteLine(1,xh,sname,mark) MsgBox("写入成功") FileClose() End Sub Private Sub Button2_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button2.Click Label5.Visible = True TextBox5.Visible = True Dim data As String FileOpen(1,"D:\data.txt",OpenMode.Input) While Not EOF(1) data = LineInput(1) 'Chr(13)表示空格 Chr(10)表示换行 TextBox5.Text = TextBox5.Text & data & Chr(13) & Chr(10) End While FileClose(1) End Sub Private Sub Button3_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button3.Click TextBox5.Text = "" End Sub Private Sub Button4_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button4.Click Dim data As String FileOpen(1,OpenMode.Input) While Not EOF(1) data = LineInput(1) 'Chr(13)表示空格 Chr(10)表示换行 If InStr(data,TextBox6.Text) Then TextBox5.Text = Replace(data,"","") & Chr(13) & Chr(10) End If End While FileClose(1) End Sub Private Sub Button5_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button5.Click Dim data As String FileOpen(1,OpenMode.Output) While Not EOF(1) data = LineInput(1) 'Chr(13)表示空格 Chr(10)表示换行 If InStr(data,TextBox6.Text) Then PrintLine(Replace(data,)) End If End While FileClose(1) End Sub End Class