English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
所有分類

如何用vb寫出筆記本程式??
如何用vb寫出筆記本程式??

2004-12-29 04:42:28 · 3 個解答 · 發問者 Anonymous in 電腦與網際網路 程式設計

3 個解答

筆記本...
文字編輯器吧
應具有基本的開啟舊檔,儲存檔案,剪下,複製,貼上唄

' -----------------------------------------------
' 開啟舊檔 -
' -----------------------------------------------
Private Sub cmdOpen_Click()
On Error GoTo ErrHandler ' 按取消鈕則跳至ErrHandler
CmDialog1.Filter = "Text files(*.txt) | *.txt"
CmDialog1.FilterIndex = 1
CmDialog1.Action = 1 ' 開啟舊檔對話方塊
Open CmDialog1.filename For Input As #1 ' 開檔
While Not EOF(1) ' 讀檔
Line Input #1, Lstr
txtDemo.Text = txtDemo.Text + Lstr + Chr(13) + Chr(10)
Wend
Close #1 ' 關檔
ErrHandler:
Exit Sub
End Sub

' -----------------------------------------------
' 另存新檔 -
' -----------------------------------------------
Private Sub cmdSave_Click()
On Error GoTo ErrHandler ' 按取消鈕則跳至ErrHandler
CmDialog1.Filter = "Text files(*.txt) | *.txt"
CmDialog1.FilterIndex = 1
CmDialog1.Action = 2 ' 存檔對話方塊
Open CmDialog1.filename For Output As #1
Print #1, txtDemo.Text ' 存檔
Close #1 ' 關檔
ErrHandler:
Exit Sub
End Sub

' -----------------------------------------------
' 物件名稱:cmdCopy 事件名稱:Click -
' -----------------------------------------------
Private Sub cmdCopy_Click()
Clipboard.Clear
Clipboard.SetText txtDemo.SelText
End Sub

' -----------------------------------------------
' 物件名稱:cmdCut 事件名稱:Click -
' -----------------------------------------------
Private Sub cmdCut_Click()
Clipboard.Clear ' 先清除剪貼簿
Clipboard.SetText txtDemo.SelText ' 放至剪貼簿
txtDemo.SelText = "" ' 清除所選字串
End Sub

' -----------------------------------------------
' 物件名稱:cmdPaste 事件名稱:Click -
' -----------------------------------------------
Private Sub cmdPaste_Click()
txtDemo.SelText = Clipboard.GetText()
End Sub

2005-01-03 21:39:38 補充:
超過5分鐘的就不寫啦=o=

真的想學的不會這樣問啦=o=

2004-12-31 03:51:36 · answer #1 · answered by Anonymous · 0 0

辛苦你了
為啥不要給它網址讓它自己去翻資料阿~"~....

2004-12-31 15:13:27 · answer #2 · answered by Anonymous · 0 0

UML魔人你真的是蠻花時間的幫人做作業辛苦你了。

2004-12-31 14:59:00 · answer #3 · answered by 走入世界另一個櫥窗 2 · 0 0

fedest.com, questions and answers