vb问题:请高手赐教!
来源:百度知道 编辑:UC知道 时间:2024/09/23 22:41:24
一个文件中以有多条信息,请问怎样把新写的信息写在文件的第一条其它的信息依次下移,请给出代码。谢谢!
如果偶的理解没错,以下代码可以满足楼主的要求:
Private bj As Boolean'新行标记
Private Sub Command1_Click()'刷新按钮,把新行加到text2前面
If Len(Text1) > 0 Then
Text2 = Text1 & vbCrLf & Text2
Text1 = ""
bj = True
End If
End Sub
Private Sub Command2_Click()'退出按钮,把text2内容存入123.txt
If bj = True Then
Dim f As Integer
f = MsgBox("有修改,存盘否?", vbYesNo + vbExclamation, "警告")
If f = vbYes Then
Open "123.txt" For Output As #2
Print #2, Text2.Text
Close #2
End If
End If
End
End Sub&n