用VB编写记事本时出现了运行错误“380”无效属性值有懂的看一下代码如下: 5
PrivateSubmnuAbout_Click()MsgBox"徐兴旺专属记事本Ver1.0版权所有(C)2012徐兴旺",vbOKOnly,"关于"EndSubPri...
Private Sub mnuAbout_Click()
MsgBox "徐兴旺专属记事本 Ver1.0 版权所有(C) 2012 徐兴旺", vbOKOnly, "关于"
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 mnuExit_Click()
End
End Sub
Private Sub mnuFind_Click()
Dim sFind As String
Dim FileType, FiType As String
sFind = InputBox("请输入要查找的字、词:", "查找内容", sFind)
RichTextBox1.Find sFind
End Sub
Private Sub Form_Resize()
On Error Resume Next '出错处理
RichTextBox1.Top = 20
RichTextBox1.Left = 20
RichTextBox1.Height = ScaleHeight - 40
RichTextBox1.Width = ScaleWidth - 40
End Sub
Private Sub mnuFindOn_Click()
RichTextBox1.SelStart = RichTextBox1.SelStart + RichTextBox1.SelLength + 1
RichTextBox1.Find sFind, , Len(RichTextBox1)
End Sub
Private Sub mnuNew_Click()
RichTextBox1.Text = "" '清空文本框
FileName = "未命名"
Me.Caption = FileName
End Sub
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 mnuPaste_Click()
RichTextBox1.SelText = Clipboard.GetText
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 mnuSelecAll_Click()
RichTextBox1.SelStart = 0
RichTextBox1.SelLength = Len(RichTextBox1.Text)
End Sub
Private Sub mnuUsage_Click()
On Error GoTo handler
RichTextBox1.LoadFile "Readme.txt", rtfText '请写好Readme.txt文件并存入程序所在文件夹中
Me.Caption = "徐兴旺专属记事本:" & "使用说明"
Exit Sub
handler:
MsgBox "使用说明文档可能已经被移除,请与作者联系。", vbOKOnly, " 错误信息"
End Sub
Private Sub RichTextBox1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
PopupMenu mnuEdit, vbPopupMenuLeftAlign
Else
Exit Sub
End If
End Sub
Private Sub RichTextBox1_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeySpace Then
RichTextBox1.SelFontName = CommonDialog1.FontName
End If
End Sub 展开
MsgBox "徐兴旺专属记事本 Ver1.0 版权所有(C) 2012 徐兴旺", vbOKOnly, "关于"
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 mnuExit_Click()
End
End Sub
Private Sub mnuFind_Click()
Dim sFind As String
Dim FileType, FiType As String
sFind = InputBox("请输入要查找的字、词:", "查找内容", sFind)
RichTextBox1.Find sFind
End Sub
Private Sub Form_Resize()
On Error Resume Next '出错处理
RichTextBox1.Top = 20
RichTextBox1.Left = 20
RichTextBox1.Height = ScaleHeight - 40
RichTextBox1.Width = ScaleWidth - 40
End Sub
Private Sub mnuFindOn_Click()
RichTextBox1.SelStart = RichTextBox1.SelStart + RichTextBox1.SelLength + 1
RichTextBox1.Find sFind, , Len(RichTextBox1)
End Sub
Private Sub mnuNew_Click()
RichTextBox1.Text = "" '清空文本框
FileName = "未命名"
Me.Caption = FileName
End Sub
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 mnuPaste_Click()
RichTextBox1.SelText = Clipboard.GetText
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 mnuSelecAll_Click()
RichTextBox1.SelStart = 0
RichTextBox1.SelLength = Len(RichTextBox1.Text)
End Sub
Private Sub mnuUsage_Click()
On Error GoTo handler
RichTextBox1.LoadFile "Readme.txt", rtfText '请写好Readme.txt文件并存入程序所在文件夹中
Me.Caption = "徐兴旺专属记事本:" & "使用说明"
Exit Sub
handler:
MsgBox "使用说明文档可能已经被移除,请与作者联系。", vbOKOnly, " 错误信息"
End Sub
Private Sub RichTextBox1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
PopupMenu mnuEdit, vbPopupMenuLeftAlign
Else
Exit Sub
End If
End Sub
Private Sub RichTextBox1_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeySpace Then
RichTextBox1.SelFontName = CommonDialog1.FontName
End If
End Sub 展开
1个回答
展开全部
是那个按钮运行出错?
追问
也不是哪个按钮出现了问题!当我生成好了EXE文件时打开文件用来编写文字只要一输入中文就出现上述现象 输入英文就没问题? 在VB里面运行就没问题可以输入中文和英文!
追答
Private Sub RichTextBox1_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeySpace Then
RichTextBox1.SelFontName = CommonDialog1.FontName
End If
End Sub
这里有问题?你用微软自带的输入法输入中文还是 谷歌输入法?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询