VB簡(jiǎn)易記事本實(shí)現(xiàn)代碼
更新時(shí)間:2012年10月10日 21:39:00 作者:
VB簡(jiǎn)易記事本實(shí)現(xiàn)代碼,需要的朋友可以參考下
事件實(shí)現(xiàn)代碼:
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 = "打開(kāi)"
End
Begin VB.Menu mSave
Caption = "保存"
End
Begin VB.Menu mNewSave
Caption = "另存為"
End
Begin VB.Menu mQuit
Caption = "退出"
Shortcut = ^E
End
End
復(fù)制代碼 代碼如下:
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控件!
屬性代碼:
復(fù)制代碼 代碼如下:
Begin VB.Menu mFile
Caption = "文件"
Begin VB.Menu mNew
Caption = "新建"
End
Begin VB.Menu mOpen
Caption = "打開(kāi)"
End
Begin VB.Menu mSave
Caption = "保存"
End
Begin VB.Menu mNewSave
Caption = "另存為"
End
Begin VB.Menu mQuit
Caption = "退出"
Shortcut = ^E
End
End
您可能感興趣的文章:
- 怎么運(yùn)行用記事本寫(xiě)的java程序
- 使用Java制作一個(gè)簡(jiǎn)單的記事本
- A notepad made in HTA(hta實(shí)現(xiàn)的記事本)
- 使用記事本編寫(xiě)java程序全過(guò)程圖解
- 簡(jiǎn)單記事本java源碼實(shí)例
- EXTJS記事本 當(dāng)CompositeField遇上RowEditor
- Excel、記事本數(shù)據(jù)導(dǎo)入到數(shù)據(jù)庫(kù)的實(shí)現(xiàn)方法
- python3.5使用tkinter制作記事本
- Python基于Tkinter實(shí)現(xiàn)的記事本實(shí)例
- Android實(shí)現(xiàn)記事本功能(26)
相關(guān)文章
VB鍵盤(pán)鼠標(biāo)無(wú)動(dòng)作調(diào)用程序的嘗試
這篇文章主要介紹了VB鍵盤(pán)鼠標(biāo)無(wú)動(dòng)作調(diào)用程序的嘗試,記錄下整個(gè)思路和過(guò)程,有需要的小伙伴可以參考下。2015-06-06VB簡(jiǎn)單實(shí)現(xiàn)防止文件被改寫(xiě)
這篇文章主要介紹了VB簡(jiǎn)單實(shí)現(xiàn)防止文件被改寫(xiě)的方法,十分的簡(jiǎn)單實(shí)用,有需要的小伙伴可以參考下。2015-06-06在VB中遍歷文件并用正則表達(dá)式完成復(fù)制及vb實(shí)現(xiàn)重命名、拷貝文件夾的方法
這篇文章主要介紹了在VB中遍歷文件并用正則表達(dá)式完成復(fù)制及vb實(shí)現(xiàn)重命名、拷貝文件夾的方法,需要的朋友可以參考下2018-12-12VB FileSystemObject對(duì)象實(shí)例詳解
FileSystemObject對(duì)象被用來(lái)訪問(wèn)服務(wù)器上的文件系統(tǒng)。這個(gè)對(duì)象能夠處理文件、文件夾和目錄路徑。用它來(lái)檢索文件系統(tǒng)信息也是可能的,而且vb與vbs、asp都是差不多的語(yǔ)法2018-12-12VB實(shí)現(xiàn)鼠標(biāo)繪圖實(shí)例代碼
這篇文章主要介紹了VB實(shí)現(xiàn)鼠標(biāo)繪圖實(shí)例代碼,很實(shí)用的一個(gè)功能,需要的朋友可以參考下2014-07-07