退出时候保存对话框的弹出

来源:百度知道 编辑:UC知道 时间:2024/06/29 01:20:25
在制作程序的时候需要在退出时候弹出保存的对话框,以下是程序原代码
请解释一下详细的意思,谢谢
Private Sub menu12_Click() '打开文件
Dim alltext As String
Close #1 '设置过滤器
CommonDialog1.ShowOpen
If CommonDialog1.FileName <> "" Then
Text10.Text = ""
Open CommonDialog1.FileName For Input As #1 '读入文件
Do While Not EOF(1)
Input #1, alltext
Text10.Text = Text10.Text & alltext & Chr(13) & Chr(10)
Loop
End If
savenot = False
End Sub

Private Sub menu12_Click() '打开文件
Dim alltext As String ' alltext是个字符串
Close #1 '设置过滤器
CommonDialog1.ShowOpen ‘显示保存对话框
If CommonDialog1.FileName <> "" Then ’如果文件名不为空
Text10.Text = "" ’ text10置为空
Open CommonDialog1.FileName For Input As #1 '读入文件
Do While Not EOF(1) ‘循环开始,如果没有到文件尾
Input #1, alltext ’读入一行赋值给alltext
‘text10追加显示,回车换行
Text10.Text = Text10.Text & alltext & Chr(13) & Chr(10)
Loop ‘ 循环结束
End If ’判断文件名为空结束
savenot = False ‘保存标志置为false
End Sub