Private Sub Form_Load( )
Open "d:/temp/dat.txt" For Output As #1
Text1.Text=""
E.nd Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii=13 Then
If UCase(Text1.Text)= (14) Then
C.lose #1
E.nd
E.lse
Write #1, (15)
Text1.Text=""
E.nd If
E.nd If
E.nd Sub
以上程序的功能是:在 D 盘 temp 文件夹下建立一个名为 dat.txt 的文件,在文本框中输入字符,每次按
回车键都把当前文本框中的内容写入文件 dat.txt,并清除文本框中的内容:如果输入“END”,则不写入
文件,直接结束程序。请填空。