Do While Not EOF(1)
Line Input #1, Text$
All$ = All$ + Text$ + Chr(13) + Chr(10)
Loop
Text1.Text = All
Close #1
End If
Else
Call saveAsMenu_Click
Form1.Caption = "我的记事本"
Form1.CommonDialog1.Filter = "文本文件|*.txt"
Form1.CommonDialog1.Flags = 4096
Form1.CommonDialog1.Action = 1
If Len(Form1.CommonDialog1.FileName)0 Then
sFileName = Form1.CommonDialog1.FileName
Form1.Caption = Form1.Caption"--"Form1.CommonDialog1.FileTitle
Open sFileName For Input As #1
Text1.FontSize = 15
Text1.FontName = "宋体"
Do While Not EOF(1)
Line Input #1, Text$
All$ = All$ + Text$ + Chr(13) + Chr(10)
Loop
Text1.Text = All
Close #1
End If
End If
End Sub
Private Sub pasteMenu_Click()'粘贴菜单代码
Text1.Text = Left(Text1.Text, Text1.SelStart) + Clipboard.GetText() + Mid(Text1.Text, Text1.SelStart + Text1.SelLength + 1)
End Sub
Private Sub printMenu_Click()
Form1.CommonDialog1.ShowPrinter
For i = 1 To CommonDialog1.Copies
Printer.Print Text1.Text
Printer.Print Text1.Text
Next
Printer.EndDoc
End Sub
Private Sub saveAsMenu_Click()'另存为菜单代码
If Len(Trim(Text1.Text))0 Then
Form1.CommonDialog1.DialogTitle = "保存文件"
Form1.CommonDialog1.InitDir = "D:\"
Form1.CommonDialog1.Filter = "文本文件|*.txt"
Form1.CommonDialog1.Flags = 2
Form1.CommonDialog1.ShowSave
If Len(Form1.CommonDialog1.FileName)0 Then
sFileName = Form1.CommonDialog1.FileName
Open sFileName For Output As #1
whole$ = Text1.Text
Print #1, whole
Close #1
End If
End If
End Sub
Private Sub saveMenu_Click()
If Len(Trim(Text1.Text))0 Then
Form1.CommonDialog1.DialogTitle = "保存文件"
Form1.CommonDialog1.InitDir = "D:\"
Form1.CommonDialog1.FileName = "新建文本"
Form1.CommonDialog1.Filter = "文本文件|*.txt"
Form1.CommonDialog1.Flags = 2
Form1.CommonDialog1.ShowSave
If Len(Form1.CommonDialog1.FileName)0 Then
sFileName = Form1.CommonDialog1.FileName
Open sFileName For Output As #1
whole$ = Text1.Text
Print #1, whole
Close #1
End If
End If
End Sub
Private Sub statusMenu_Click()
End Sub
VB编写记事本vb编写的简单记事本代码
Dim b As String
Dim a As String
Dim m As String
Dim x As String
Private Declare Function SetWindowPos Lib "user32" ( _
ByVal hwnd As Long, _
ByVal hWndInsertAfter As Long, _
ByVal x As Long, ByVal Y As Long, _
ByVal cx As Long, ByVal cy As Long, _
ByVal wFlags As Long _
) As Long
Const HWND_TOPMOST = -1
Const SWP_SHOWWINDOW = H40
Private Sub baocun_Click()
Dim abc As String
If Len(Trim(m)) = 0 Then
m = "f:"
End If
abc = m"\"Text2.Text".txt"
Open abc For Output As #1
Write #1, Text1.Text
Close #1
Label2.Caption = "保存的路径为:"m"\"Text2.Text".txt"
a = MsgBox("保存成功!"Chr(13)"是否退出程序", 4 + 64 + 0, "提示")
If a = vbYes Then
End
End If
End Sub
Private Sub Command1_Click()
Dir1.Visible = False
Drive1.Visible = False
m = Dir1.Path
Command1.Visible = False
b = MsgBox("你选的文件夹是:"m, vbYesNo + vbDefaultButton1 + 48, "提示")
If b = vbNo Then
Dir1.Visible = True
Drive1.Visible = True
Command1.Visible = True
Else
Dir1.Visible = False
Drive1.Visible = False
Command1.Visible = False
End If
End Sub
Private Sub Command2_Click()
MsgBox (App.Path + "1.ico")
End Sub
Private Sub dakai_Click()
CommonDialog1.Filter = "文本文件(*.txt)|*.txt"
推荐阅读
- 忍者动作游戏系列游戏,忍者动作手游
- 怎么扩大字体苹果手机软件,iphone怎么设置字体
- 邵阳学新媒体如何选择,学新媒体报什么专业
- mysql表太大怎么分表 mysql大表分区
- oracle查询序列最大数,oracle如何查询序列
- jquery网站收藏,网页链接收藏
- gis九段线,arcgis九段线
- java代码覆盖率是多少 java覆盖equals方法
- 金立用华为鸿蒙,金立刷华为系统