Re: Passing "Controls" collection to a class method not defined in .ctl file
- From: Eric Chevalier <etech@xxxxxxxxxxxxxxxx>
- Date: Sat, 09 Aug 2008 13:52:33 -0500
Hi Larry,
On Fri, 8 Aug 2008 23:58:58 -0500, "Larry Serflaten"
<serflaten@xxxxxxxxxxxxxx> wrote:
How about passing the form instead. With access to the
form, you can gain access to its Controls collection, plus
Forms have a 'generic' interface you can use (Form) to
allow you to pass any VB form by reference.
I've tried a couple of approaches, and still not having any success.
First, I've changed the call in my UserControl_Initialize() function
to:
Private Sub UserControl_Initialize()
' *** snipped for brevity ***
Viewer.Setup Me
Then I changed my class method to:
Public Function Setup(ByRef Form As Form) As Boolean
Temp = Form.Controls.Count
That gives me the error: "Private object modules cannot be used in
public object modules as parameters or return types for public
procedures, as public data members, or as fields of public user
defined types." I'm a little stumped because the properties for my
form show "Public: Yes". I tried changing the definition of
UserControl_Initialize() to "Public", but that didn't fly (same
error).
Changing the method definition to:
Public Function Setup(Form As Form) As Boolean
generated the same error.
Next, I tried replacing "As Form" with the actual name of my form
module:
Public Function Setup(Form As nsvShowObject) As Boolean
Temp = Form.Controls.Count
But now the assignment to Temp fails because "Controls" is recognized
as a member of "Form", which suggests that "Controls" must be defined
as a Private member. I'm going to do a little more digging, but I have
a feeling that I can't change the definition of "Controls" to be
public.
Any thoughts, suggestions?
Eric
.
- Follow-Ups:
- Re: Passing "Controls" collection to a class method not defined in .ctl file
- From: Larry Serflaten
- Re: Passing "Controls" collection to a class method not defined in .ctl file
- References:
- Passing "Controls" collection to a class method not defined in .ctl file
- From: Eric Chevalier
- Re: Passing "Controls" collection to a class method not defined in .ctl file
- From: Larry Serflaten
- Passing "Controls" collection to a class method not defined in .ctl file
- Prev by Date: Re: Passing "Controls" collection to a class method not defined in .ctl file
- Next by Date: Re: Passing "Controls" collection to a class method not defined in .ctl file
- Previous by thread: Re: Passing "Controls" collection to a class method not defined in .ctl file
- Next by thread: Re: Passing "Controls" collection to a class method not defined in .ctl file
- Index(es):
Relevant Pages
|