欢迎来到工商注册核名查询系统!

vb

当前位置:主页 > 软件编程 > vb >

VB简易记事本实现代码

来源:本站原创|时间:2022-11-25|栏目:vb|

实现代码:

复制代码 代码如下:

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

更多vb

您可能感兴趣的文章

阅读排行

本栏相关

随机阅读

网页制作CMS教程网络编程软件编程脚本语言数据库服务器

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:835971066 | 邮箱:835971066#qq.com(#换成@)

Copyright © 2002-2020 工商注册核名查询系统 版权所有