程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> Visual Basic語言 >> VB綜合教程 >> VB簡易記事本完成代碼

VB簡易記事本完成代碼

編輯:VB綜合教程

VB簡易記事本完成代碼。本站提示廣大學習愛好者:(VB簡易記事本完成代碼)文章只能為提供參考,不一定能成為您想要的結果。以下是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
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved