Event implementation code:
Copy codeThe Code is as follows: Private Sub mQuit_Click ()
Text1.Text = ""
End
End Sub
Private Sub mNew_Click ()
Text1.Text = ""
Form1.Caption = "unnamed"
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 = "not named" 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 control is required!
Property Code:Copy codeThe Code is as follows: Begin VB. Menu mFile
Caption = "file"
Begin VB. Menu mNew
Caption = "new"
End
Begin VB. Menu mOpen
Caption = "open"
End
Begin VB. Menu mSave
Caption = "save"
End
Begin VB. Menu mNewSave
Caption = "Save"
End
Begin VB. Menu mQuit
Caption = "quit"
Export cut = ^ E
End
End