VB 新手,清问一下object 是不是要引用什么部件啊。

binbin50 2008-07-10 09:36:06
'获取串信息,该串信息不仅包含连接串信息还包括其他一些信息,具体参见下面的属性方法
Private Function GetConnectionProperty(strName As String, Optional ByVal bRaiseError As Boolean = True) As Variant

Dim spmMgr As Object
Dim lProc As Long
lProc = GetCurrentProcessId()
Set spmMgr = CreateObject("PropsMgr.ShareProps")
If IsObject(spmMgr.GetProperty(lProc, strName)) Then '这一句调不过去,提示,无效的过程调用或参数
Set GetConnectionProperty = spmMgr.GetProperty(lProc, strName)
Else
GetConnectionProperty = spmMgr.GetProperty(lProc, strName)
End If
End Function
'-----------------------------------------------------------------------------------------------
If IsObject(spmMgr.GetProperty(lProc, strName)) Then --这一句调不过去,提示,无效的过程调用或参数
请高手,老手指教。谢谢!
...全文
179 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
datou985 2008-07-11
  • 打赏
  • 举报
回复
单从代码来看应该是没有问题的
你的代码是判断spmMgr.GetProperty(lProc, strName)是对象还是一般变量
以决定是用Set还是直接赋值

既然在那里报了个错,那你最好在执行了
Set spmMgr = CreateObject("PropsMgr.ShareProps")
之后用Add Watch的方法看一下spmMgr 的内容是否为Nothing
如果是nothing的话,那么可能是PropsMgr.ShareProps没有创建成功
否则就不太清楚是什么原因了
binbin50 2008-07-11
  • 打赏
  • 举报
回复
不是的,原来是这一句不支持调式,编译后就可以了。
hansuzhi 2008-07-11
  • 打赏
  • 举报
回复
顶1楼,IsObject这个函数是判断变量是不是对象
Sandrer 2008-07-10
  • 打赏
  • 举报
回复
If IsObject(spmMgr) Then

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧