|
-
Sep 25th, 2002, 10:47 PM
#1
Thread Starter
PowerPoster
Assign a UDT to a variant array?
I am trying (in a .bas module) to assign a UDT (declared in the same module) to a variant array (in the same module). I get this error:
"You attempted to use a public user defined type as a parameter or return type for a public procedure of a class module, or as a field of a public user defined type. Only public user defined types that are defined in a public object module can be used in this manner. "
*** does that all mean?? And how do I resolve this?
-----------------------------------------
-RJ
[email protected]
-----------------------------------------
-
Sep 25th, 2002, 11:04 PM
#2
The picture isn't missing
mabye try making the UDT public?
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Sep 25th, 2002, 11:07 PM
#3
Thread Starter
PowerPoster
Done that. Don't work.
-----------------------------------------
-RJ
[email protected]
-----------------------------------------
-
Sep 25th, 2002, 11:09 PM
#4
What kind of project is it, a DLL?
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Sep 25th, 2002, 11:13 PM
#5
Thread Starter
PowerPoster
Just a McRegular .exe.
VB Code:
'Declarations:
'Single choice question
Private Type QuestionSC
qtQuestionType As QuestionType
strQuestion As String
audFilename As String
End Type
'Question list
Private varQuestionList As Variant
Sub BuggeredSub()
Dim qtSCQuestion As QuestionSC
qtSCQuestion.qtQuestionType = QT_SINGLE_CHOICE
varQuestionList(0) = qtSCQuestion
End Sub
That's the Gist of it. The above is in a .bas module.
-----------------------------------------
-RJ
[email protected]
-----------------------------------------
-
Sep 25th, 2002, 11:14 PM
#6
Thread Starter
PowerPoster
And no, changing all the above to public makes no difference.
-----------------------------------------
-RJ
[email protected]
-----------------------------------------
-
Sep 25th, 2002, 11:16 PM
#7
Hmmm, the only error I got was that private Types can't be coerced to Variants.
I give up.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Sep 25th, 2002, 11:18 PM
#8
Thread Starter
PowerPoster
Originally posted by crptcblade
Hmmm, the only error I got was that private Types can't be coerced to Variants.
I give up.
Yeah, that's the error message. The above was from the Help on that error, apologies. Nonetheless, it doesn't frickin work anyway... stoopid precompiler...
-----------------------------------------
-RJ
[email protected]
-----------------------------------------
-
Sep 25th, 2002, 11:21 PM
#9
Yeah, to do what you want, the Type has to be declared as Public in an object module, like a class or uc. Why can't you have a QuestionSC array?
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Sep 25th, 2002, 11:31 PM
#10
Thread Starter
PowerPoster
BEcause there are at least 2 other types I want in that array... 
I'm trying to make a quick hard-coded solution for an 'exam' of sorts.
I also tried putting it in a class, and it still gave me the same error...
-----------------------------------------
-RJ
[email protected]
-----------------------------------------
-
Sep 25th, 2002, 11:32 PM
#11
Thread Starter
PowerPoster
Can I have a public class in a standard .exe?
-----------------------------------------
-RJ
[email protected]
-----------------------------------------
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|