乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 23|回复: 1

调试错误(参数不正确)

[复制链接]

194

主题

592

帖子

11

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1380
发表于 2006-10-16 14:06:17 | 显示全部楼层 |阅读模式
让我看看我是否能解释这个。我有一个函数;
  1. Public Function PointTest(Pt As Long) As Boolean
  2.    
  3.     If getCivilObjects = False Then
  4.         Exit Function
  5.     End If
  6.    
  7.     Dim oPoint As AeccPoint
  8.    
  9.     Set oPoint = AllPoints.Find(Pt)  [code]if oPoint is nothing then exit function

您可以使用以下内容:
  1. if oPoint is nothing then goto ExitHere

当发生错误时调用例程的最后一部分:
  1. ErrorHandler:
  2.         select case Err.number
  3.         case -22222 '<-This would be where the error that is thrown from the .Find method
  4.                 resume next 'resume on the line following where the error was thrown
  5.         case else
  6.                 msgbox "Something just happened... " & err.number
  7.         end select
  8.        
  9.         resume ExitHere
  10. end function

当发生错误时,遵循“On Error Goto ErrorHandler”,程序立即在“ErrorHandler”标签之后的行上继续执行。在这种情况下,选择语句。您感兴趣的是捕获查找方法生成的错误。这就是为什么我有“case-2222”,我不知道抛出了什么错误号。而不是-2222,您会输入生成的错误号。下一行“继续下一步”告诉程序立即跳回到通过错误的行之后的行。
这有意义吗?如果您需要更好的解释,请告诉我,我今晚会看看我能做些什么。
回复

使用道具 举报

194

主题

592

帖子

11

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1380
发表于 2006-10-16 14:22:33 | 显示全部楼层

是的,非常感谢!
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-7-6 20:31 , Processed in 0.300310 second(s), 57 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表