VB简易记事 VB简易记事本实现代码

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

VB简易记事 VB简易记事本实现代码

  2021-03-19 我要评论
想了解VB简易记事本实现代码的相关内容吗,在本文为您仔细讲解VB简易记事的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:记事本,下面大家一起来学习吧。
事件实现代码:
复制代码 代码如下:

Private Sub mQuit_Click()
Text1.Text = ""
End
End Sub

Private Sub mNew_Click()
Text1.Text = ""
Form1.Caption = "未命名"
End Sub
Private Sub mopen_Click()
CommonDialog1.ShowOpen
Frame = CommonDialog1.FileName
If fname <> "" Then
Form1.Caption = fname
Text1.Text = ""
Open fname For Input As #1
b = ""
Do Until EOF(1)
Line Input #1, nextline
b = b & nextline & Chr(13) & Chr(10)
Loop
Close #1
Text1.Text = b
End If
End Sub
Private Sub mSave_Click()
If Form1.Caption = "未命名" Or Form1.Caption = "" Then
CommonDialog1.ShowSave
fname = CommonDialog1.FileName
Else
fname = Form1.Caption
End If
If fname <> "" Then
Form1.Caption = fname
Open fname For Output As #1
Print #1, Text1.Text
Close #1
End If
End Sub
Private Sub mNewSave_Click()
CommonDialog1.ShowSave
If fname <> "" Then
Form1.Caption = fname
Open fname For Output As #1
Print #1, Text1.Text
Close #1
End If
End Sub

需要用CommonDialog控件!
属性代码:
复制代码 代码如下:

Begin VB.Menu mFile
Caption = "文件"
Begin VB.Menu mNew
Caption = "新建"
End
Begin VB.Menu mOpen
Caption = "打开"
End
Begin VB.Menu mSave
Caption = "保存"
End
Begin VB.Menu mNewSave
Caption = "另存为"
End
Begin VB.Menu mQuit
Caption = "退出"
Shortcut = ^E
End
End

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们