VB程序设计记事本
这是我自己在网上找的但是运行起来不对帮我改改PrivateSubmnuOpen_Click()CommonDialog1.Filter="文本文档(*.txt)|*.tx...
这是我自己在网上找的 但是运行起来不对 帮我改改
Private Sub mnuOpen_Click()
CommonDialog1.Filter = "文本文档(*.txt)|*.txt|RTF文档(*.rtf)|*.rtf|所有文件(*.*)|*.*"
CommonDialog1.ShowOpen
RichTextBox1.Text = "" '清空文本框
FileName = CommonDialog1.FileName
RichTextBox1.LoadFile FileName
Me.Caption = "超级记事本:" & FileName
End Sub
Private Sub mnuSave_Click()
CommonDialog1.Filter = "文本文档(*.txt)|*.txt|RTF文档(*.rtf)|*.rtf|所有文件(*.*)|*.*"
CommonDialog1.ShowSave
FileType = CommonDialog1.FileTitle
FiType = LCase(Right(FileType, 3))
FileName = CommonDialog1.FileName
Select Case FiType
Case "txt"
RichTextBox1.SaveFile FileName, rtfText
Case "rtf"
RichTextBox1.SaveFile FileName, rtfRTF
Case "*.*"
RichTextBox1.SaveFile FileName
End Select
Me.Caption = "超级记事本:" & FileName
End Sub
Private Sub mnuCopy_Click()
Clipboard.Clear
Clipboard.SetText RichTextBox1.SelText
End Sub
Private Sub mnuCut_Click()
Clipboard.Clear
Clipboard.SetText RichTextBox1.SelText
RichTextBox1.SelText = ""
End Sub
Private Sub mnuPaste_Click()
RichTextBox1.SelText = Clipboard.GetText
End Sub
Private Sub mnuFont_Click()
CmdOpen.Flags = cdlCFBoth + cdlCFEffects
CmdOpen.ShowFont
With RichTextBox1
.SelFontName = CmdOpen.FontName
.SelFontSize = CmdOpen.FontSize
.SelBold = CmdOpen.FontBold
.SelItalic = CmdOpen.FontItalic
.SelStrikeThru = CmdOpen.FontStrikethru
.SelUnderline = CmdOpen.FontUnderline
End With
End Sub
文件(第一层) mnuFile
打开(第二层) mnuOpen
保存(第二层) mnuSave
编辑(第一层) mnuEdit
复制(第二层) mnuCopy
剪切(第二层) mnuCut
粘贴(第二层) mnuPaste
格式 字体formfont 展开
Private Sub mnuOpen_Click()
CommonDialog1.Filter = "文本文档(*.txt)|*.txt|RTF文档(*.rtf)|*.rtf|所有文件(*.*)|*.*"
CommonDialog1.ShowOpen
RichTextBox1.Text = "" '清空文本框
FileName = CommonDialog1.FileName
RichTextBox1.LoadFile FileName
Me.Caption = "超级记事本:" & FileName
End Sub
Private Sub mnuSave_Click()
CommonDialog1.Filter = "文本文档(*.txt)|*.txt|RTF文档(*.rtf)|*.rtf|所有文件(*.*)|*.*"
CommonDialog1.ShowSave
FileType = CommonDialog1.FileTitle
FiType = LCase(Right(FileType, 3))
FileName = CommonDialog1.FileName
Select Case FiType
Case "txt"
RichTextBox1.SaveFile FileName, rtfText
Case "rtf"
RichTextBox1.SaveFile FileName, rtfRTF
Case "*.*"
RichTextBox1.SaveFile FileName
End Select
Me.Caption = "超级记事本:" & FileName
End Sub
Private Sub mnuCopy_Click()
Clipboard.Clear
Clipboard.SetText RichTextBox1.SelText
End Sub
Private Sub mnuCut_Click()
Clipboard.Clear
Clipboard.SetText RichTextBox1.SelText
RichTextBox1.SelText = ""
End Sub
Private Sub mnuPaste_Click()
RichTextBox1.SelText = Clipboard.GetText
End Sub
Private Sub mnuFont_Click()
CmdOpen.Flags = cdlCFBoth + cdlCFEffects
CmdOpen.ShowFont
With RichTextBox1
.SelFontName = CmdOpen.FontName
.SelFontSize = CmdOpen.FontSize
.SelBold = CmdOpen.FontBold
.SelItalic = CmdOpen.FontItalic
.SelStrikeThru = CmdOpen.FontStrikethru
.SelUnderline = CmdOpen.FontUnderline
End With
End Sub
文件(第一层) mnuFile
打开(第二层) mnuOpen
保存(第二层) mnuSave
编辑(第一层) mnuEdit
复制(第二层) mnuCopy
剪切(第二层) mnuCut
粘贴(第二层) mnuPaste
格式 字体formfont 展开
1个回答
展开全部
你的程序 我这里运行一切正常 你遇到了什么问题?
创建新工程,按Ctrl+t, 把 Microsoft Common Dialog Control 6.0 选上
再选上 Microsoft Rich Textbox Control 6.0 然后点OK
窗体上增加 两个 commondialog 一个 名字是 CommonDialog1 一个名字是 cmdopen
再增加一个 RichTextBox
增加Menu 然后就能运行了
创建新工程,按Ctrl+t, 把 Microsoft Common Dialog Control 6.0 选上
再选上 Microsoft Rich Textbox Control 6.0 然后点OK
窗体上增加 两个 commondialog 一个 名字是 CommonDialog1 一个名字是 cmdopen
再增加一个 RichTextBox
增加Menu 然后就能运行了
更多追问追答
追问
根本就运行不出来啊 出现424的错误
追答
出错后,光条会停留在某个位置,表示那个位置有问题,把你出错的位置告诉我 我能帮你分析 呵呵
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询