
VB生成EXE出现编译错误,未找到方法或数据成员
DimsFindAsStringDimFileType,FiTypeAsStringPrivateSubForm_Load()Me.Height=6000Me.Width...
Dim sFind As String
Dim FileType, FiType As String
Private Sub Form_Load()
Me.Height = 6000
Me.Width = 9000
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 RichTextBox1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
PopupMenu 编辑, vbPopupMenuLeftAlign
Else: Exit Sub
End If
End Sub
Private Sub 保存_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 查找_Click()
sFind = InputBox("请输入要查找的字、词:", "查找内容", sFind)
RichTextBox1.Find sFind
End Sub
Private Sub 查找下一个_Click()
RichTextBox1.SelStart = RichTextBox1.SelStart + RichTextBox1.SelLength + 1
RichTextBox1.Find sFind, , Len(RichTextBox1)
End Sub
Private Sub 打开_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 复制_Click()
Clipboard.Clear
Clipboard.SetTextRichTextBox1.SelText
End Sub
Private Sub 红心大战_Click()
Shell "c:\windows\system32\mshearts.exe", vbNormalFocus
End Sub
Private Sub 画图_Click()
Shell "c:\windows\system32\mspaint.exe", vbNormalFocus
End Sub
Private Sub 计算器_Click()
Shell "c:\windows\system32\calc.exe", vbNormalFocus
End Sub
Private Sub 剪切_Click()
Clipboard.Clear
Clipboard.SetText RichTextBox1.SelText
RichTextBox1.SelText = ""
End Sub
Private Sub 空当接龙_Click()
Shell "c:\windows\system32\freecell.exe", vbNormalFocus
End Sub
Private Sub 全选_Click()
RichTextBox1.SelStart = 0
RichTextBox1.SelLength = Len(RichTextBox1.Text)
End Sub
Private Sub 扫雷_Click()
Shell "c:\windows\system32\winmine.exe", vbNormalFocus
End Sub 展开
Dim FileType, FiType As String
Private Sub Form_Load()
Me.Height = 6000
Me.Width = 9000
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 RichTextBox1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
PopupMenu 编辑, vbPopupMenuLeftAlign
Else: Exit Sub
End If
End Sub
Private Sub 保存_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 查找_Click()
sFind = InputBox("请输入要查找的字、词:", "查找内容", sFind)
RichTextBox1.Find sFind
End Sub
Private Sub 查找下一个_Click()
RichTextBox1.SelStart = RichTextBox1.SelStart + RichTextBox1.SelLength + 1
RichTextBox1.Find sFind, , Len(RichTextBox1)
End Sub
Private Sub 打开_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 复制_Click()
Clipboard.Clear
Clipboard.SetTextRichTextBox1.SelText
End Sub
Private Sub 红心大战_Click()
Shell "c:\windows\system32\mshearts.exe", vbNormalFocus
End Sub
Private Sub 画图_Click()
Shell "c:\windows\system32\mspaint.exe", vbNormalFocus
End Sub
Private Sub 计算器_Click()
Shell "c:\windows\system32\calc.exe", vbNormalFocus
End Sub
Private Sub 剪切_Click()
Clipboard.Clear
Clipboard.SetText RichTextBox1.SelText
RichTextBox1.SelText = ""
End Sub
Private Sub 空当接龙_Click()
Shell "c:\windows\system32\freecell.exe", vbNormalFocus
End Sub
Private Sub 全选_Click()
RichTextBox1.SelStart = 0
RichTextBox1.SelLength = Len(RichTextBox1.Text)
End Sub
Private Sub 扫雷_Click()
Shell "c:\windows\system32\winmine.exe", vbNormalFocus
End Sub 展开
3个回答
展开全部
生成exe之前,先要F5运行一下,看看出错在哪里(蓝底高亮显示的地方)
你这个问题多半是因为某个控件的方法或属性写错了
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你可能需要引用组件:RichTextBox、CommonDialog。
在每个过程里的开始放入代码“On Error Resume Next”
在每个过程里的结束处放入代码:
if err.number<>0 then msgbox err.number & vbcrlf & err.Description
然后在编程状态按下F8测试
在每个过程里的开始放入代码“On Error Resume Next”
在每个过程里的结束处放入代码:
if err.number<>0 then msgbox err.number & vbcrlf & err.Description
然后在编程状态按下F8测试
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
点击运行->全编译执行,报错后光标会定位在出错的地方,这样就容易排错了。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询