|
-
January 2nd, 2010, 03:04 AM
#1
public object modules?
Hello I set up a "type", included in my .bas module...seems to work fine:
Code:
Public Type DynaData
FramePar As Integer
VIndex As Integer
EEPloc As Integer
NoRespOK As Boolean
End Type
In my main form General Declarations I do:
Code:
Dim RadBut(200) As DynaData
I use this without problem in various routines & various calculations. However I need to pass this type to a sub (as well as similar types to the same sub, which is why I want to create a sub in the first place)
Code:
call MYSub(123, RadBut() ) 'should it be plain RadBut or RadBut()?
such as:
Code:
Public Sub MySub(intAbc as Integer, FakeType as DynaData)
...however here it gives a compiler error saying
"only public user defined types defined in public object modules can be used as parameters..... "
Ok so where should I put my type definition (what IS a public object module?) or how do I make one of my private modules public?
Last edited by vbcandies; January 2nd, 2010 at 03:14 AM.
-
January 2nd, 2010, 03:56 AM
#2
Re: public object modules?
-
January 2nd, 2010, 06:58 AM
#3
Re: public object modules?
Where are you trying to put the Public Sub?
Please remember to rate the posts and threads that you find useful.
How can something be both new and improved at the same time?
-
January 2nd, 2010, 10:39 AM
#4
Re: public object modules?
Where are you trying to put the Public Sub? ...in my "program" That is, I click on the form, and that is where all of my other code is located.
Where should I place my Type definition? Any example would be helpful
-
January 3rd, 2010, 11:19 AM
#5
Re: public object modules?
If you want to pass a complete array to a sub you have to declare your parameter accordingly:
Code:
Public Sub MySub(intAbc as Integer, FakeType() as DynaData)
'This allows later
MySub 5, RadBut
'or
Call MySub(5, RadBut)
'which is the same
Last edited by WoF; January 4th, 2010 at 09:29 AM.
Reason: corrected a typo with the brackets
-
January 3rd, 2010, 02:48 PM
#6
Re: public object modules?
If you move the Public Sub (declared as WoF suggests) to the .bas module, it should work. Then you can call the sub from any form in your program.
Please remember to rate the posts and threads that you find useful.
How can something be both new and improved at the same time?
-
January 4th, 2010, 12:58 PM
#7
Re: public object modules?
I changed the type of sub I was having trouble with from public to private & POOF ...all the compiler errors went away & it works just fine!
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
|