Accessing Types in a Class Module Problem 
Author Message
 Accessing Types in a Class Module Problem

Hi all,
I have this set up in a Class Module:

Friend Function RgnGetObjectFromRegions(lRgnRegionsIndex As Long) As typRgnObjectDiscription
    If lRgnRegionsIndex >= 0 And _
       lRgnRegionsIndex <= m_lRgnRegionsCount Then
       RgnGetObjectFromRegions = m_tRgnRegions(lRgnRegionsIndex)
    End If
End Function
typRgnObjectDiscription is defined Private in the Class
m_tRgnRegions is an array of type typRgnObjectDiscription

Then in a Module I try to access it using:

   vRgnObject = clsRgn.RgnGetObjectFromRegions(lLp)

and I get an error 'User-Defined Type Not Defined'
clsRgn is declared as clsRgnRegions. My Class Module.
vRgnObject is a Variant...

I can't recall having this kind of problem before or I'm doing something different and don't see it...

Have a good day...

Don



Sat, 02 Jul 2005 01:11:55 GMT  
 Accessing Types in a Class Module Problem
If I follow your posting correctly you are trying to shove a UDT into
a Variant.

Friend is for shoving UDTs into (the same type of) UDT

Quote:

>Hi all,
>I have this set up in a Class Module:

>Friend Function RgnGetObjectFromRegions(lRgnRegionsIndex As Long) As typRgnObjectDiscription
>    If lRgnRegionsIndex >= 0 And _
>       lRgnRegionsIndex <= m_lRgnRegionsCount Then
>       RgnGetObjectFromRegions = m_tRgnRegions(lRgnRegionsIndex)
>    End If
>End Function
>typRgnObjectDiscription is defined Private in the Class
>m_tRgnRegions is an array of type typRgnObjectDiscription

>Then in a Module I try to access it using:

>   vRgnObject = clsRgn.RgnGetObjectFromRegions(lLp)

>and I get an error 'User-Defined Type Not Defined'
>clsRgn is declared as clsRgnRegions. My Class Module.
>vRgnObject is a Variant...

>I can't recall having this kind of problem before or I'm doing something different and don't see it...

>Have a good day...

>Don



Sun, 03 Jul 2005 19:44:22 GMT  
 Accessing Types in a Class Module Problem
Thanks... But I was doing something different and didn't see it... duh!!!

I moved typRgnObjectDiscription to a Module where it should have been...

Then Declared  vRgnObject as typRgnObjectDiscription and it works **Like Its Supposed Too**...

Maybe I need a few of Mikes Bud's... LOL

BTW: This is the project that I was trying to get a set of complex, well to me they were, Collections to work..
After replacing 5 keyboards, 2 CRT's, total hair loss, finger nails that won't need clipping for the next two years, relocating because of disturbing
the peace and a few other non-genteelness acts I converted it to using the more familure Arrays of UDT's.
Now I can SEE what's going on when problems happen...
Also, I got rewarded for my troubles in *SPEED*... ;-)
A couple of the routines that took better than 4 to 5 seconds to complete now take from less than to a little over  a second...
My expirience was rewarding overall and I'll continue to use collections for collecting bits and pieces of data that won't get hit several thousand
times in loops. Collections have there place but what I was trying to do just wasn't their place...

Quote:

>If I follow your posting correctly you are trying to shove a UDT into
>a Variant.

>Friend is for shoving UDTs into (the same type of) UDT


>>Hi all,
>>I have this set up in a Class Module:

>>Friend Function RgnGetObjectFromRegions(lRgnRegionsIndex As Long) As typRgnObjectDiscription
>>    If lRgnRegionsIndex >= 0 And _
>>       lRgnRegionsIndex <= m_lRgnRegionsCount Then
>>       RgnGetObjectFromRegions = m_tRgnRegions(lRgnRegionsIndex)
>>    End If
>>End Function
>>typRgnObjectDiscription is defined Private in the Class
>>m_tRgnRegions is an array of type typRgnObjectDiscription

>>Then in a Module I try to access it using:

>>   vRgnObject = clsRgn.RgnGetObjectFromRegions(lLp)

>>and I get an error 'User-Defined Type Not Defined'
>>clsRgn is declared as clsRgnRegions. My Class Module.
>>vRgnObject is a Variant...

>>I can't recall having this kind of problem before or I'm doing something different and don't see it...

>>Have a good day...

>>Don

Have a good day...

Don



Sun, 03 Jul 2005 23:23:04 GMT  
 Accessing Types in a Class Module Problem
Glad it's fixed

Personally I am not keen on collections, they just hide a lot of
things that are easy to do oneself.

Also they never seem to do the obvious things that one requires.

Actually their opaqueness spooks me

Quote:

>Thanks... But I was doing something different and didn't see it... duh!!!

>I moved typRgnObjectDiscription to a Module where it should have been...

>Then Declared  vRgnObject as typRgnObjectDiscription and it works **Like Its Supposed Too**...

>Maybe I need a few of Mikes Bud's... LOL

>BTW: This is the project that I was trying to get a set of complex, well to me they were, Collections to work..
>After replacing 5 keyboards, 2 CRT's, total hair loss, finger nails that won't need clipping for the next two years, relocating because of disturbing
>the peace and a few other non-genteelness acts I converted it to using the more familure Arrays of UDT's.
>Now I can SEE what's going on when problems happen...
>Also, I got rewarded for my troubles in *SPEED*... ;-)
>A couple of the routines that took better than 4 to 5 seconds to complete now take from less than to a little over  a second...
>My expirience was rewarding overall and I'll continue to use collections for collecting bits and pieces of data that won't get hit several thousand
>times in loops. Collections have there place but what I was trying to do just wasn't their place...


>>If I follow your posting correctly you are trying to shove a UDT into
>>a Variant.

>>Friend is for shoving UDTs into (the same type of) UDT


>>>Hi all,
>>>I have this set up in a Class Module:

>>>Friend Function RgnGetObjectFromRegions(lRgnRegionsIndex As Long) As typRgnObjectDiscription
>>>    If lRgnRegionsIndex >= 0 And _
>>>       lRgnRegionsIndex <= m_lRgnRegionsCount Then
>>>       RgnGetObjectFromRegions = m_tRgnRegions(lRgnRegionsIndex)
>>>    End If
>>>End Function
>>>typRgnObjectDiscription is defined Private in the Class
>>>m_tRgnRegions is an array of type typRgnObjectDiscription

>>>Then in a Module I try to access it using:

>>>   vRgnObject = clsRgn.RgnGetObjectFromRegions(lLp)

>>>and I get an error 'User-Defined Type Not Defined'
>>>clsRgn is declared as clsRgnRegions. My Class Module.
>>>vRgnObject is a Variant...

>>>I can't recall having this kind of problem before or I'm doing something different and don't see it...

>>>Have a good day...

>>>Don

>Have a good day...

>Don



Mon, 04 Jul 2005 01:44:52 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Accessing procedures of a class module from another class module

2. Format problem with report class modules in Access 7

3. Class modules 97 - Refering to array within a custom class module

4. instance of class module can't see own type

5. Error using user-defined type in parameter of public procedure in a class module

6. Class Module / User Defined Type

7. User Defined types into a class module

8. Compiler Error Question, attempting to make a class module see a user defined type

9. Error 13 Invalid Type in class module

10. Passing an array of user-defined data type to a class module

11. User type as a parameter for a method of a class module

12. type statement & class modules

 

 
Powered by phpBB® Forum Software