Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

VB
Public Function CallVal()

Dim configmgr As ucConfigMgr

configmgr.VA //error on this line


Set configmgr = Nothing

End Function


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
Posted

The line where your getting error try using as below

With configmgr
   .VA
End Eith
 
Share this answer
 
Comments
ankitjoshi24 29-Jun-11 13:27pm    
Hey

I tried that but still the same error.
You need to set your declared object to something.
VB
Public Function CallVal()

    Dim configmgr As ucConfigMgr
    Set configmgr = ucConfigMgr

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

    Set configmgr = Nothing

End Function
 
Share this answer
 
Comments
ankitjoshi24 29-Jun-11 13:28pm    
configmgr.VA is calling a sub procedure which is in the usercontrol.
S Houghtelin 29-Jun-11 13:29pm    
OK, this should work then.
ankitjoshi24 29-Jun-11 13:30pm    
Ya it should. Seems correct in every manner. But still it gives me that error. Not sure where I am wrong. Just if I could solve this thing.............
S Houghtelin 29-Jun-11 13:37pm    
To see if the object was successfully created try typing just configmgr, then add the "." this should expose the objects visible properties.

If nothing shows up you may to make sure that configmgr exists or that VA is a public property or function.
ankitjoshi24 29-Jun-11 13:38pm    
I have used the "." so that it shows me properly which methods or sub procedures are public and can be used. And I even reconfirmed by checking it myself and found that the sub procedure is public.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900