模块和用户控件 [英] Modules and User Controls

查看:69
本文介绍了模块和用户控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我有一个VB6项目,其中包含几个模块.他们大多数是公开的.

现在,我在项目中添加了一个简单的用户控件,在该用户控件中,我具有需要从一个模块中访问的功能.用户控件的公共属性设置为true.

在其中一个模块中,我尝试以下代码

Hello everyone

I have an VB6 project which contains of several Modules. Most of them are public.

Now I have added a simple user control to the project and in that user control, I have a function which I need to access from one of the modules. The user control''s public property is set to true.

In one of the modules, I try the following code

Public Function CallVal()

Dim configmgr As ucConfigMgr

configmgr.VA //error on this line


Set configmgr = Nothing

End Function



在上面的代码中,出现错误对象变量或未设置块变量"

我不明白哪里出了问题.

如果有人可以帮助我解决这个问题,那将非常好.

-
AJ



In the above code, I get an error "Object variable or With block variable not set"

I am not understanding where I have gone wrong.

If someone could please help me figure out this problem, it will be really great.

--
AJ

推荐答案

出现错误的行尝试如下使用

The line where your getting error try using as below

With configmgr
   .VA
End Eith


您需要将声明的对象设置为某种对象.
You need to set your declared object to something.
Public Function CallVal()

    Dim configmgr As ucConfigMgr
    Set configmgr = ucConfigMgr

    'What is this line trying to do?
    configmgr.VA 

    Set configmgr = Nothing

End Function


这篇关于模块和用户控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆