PC Review


Reply
Thread Tools Rate Thread

Calling Classes from Classes

 
 
=?Utf-8?B?SiBTdHJlZ2Vy?=
Guest
Posts: n/a
 
      22nd Mar 2007
I have several Class modules set up, each representing a larger scope than
the next, so they tier into each other. I was trying to get a string and
couldn't get it to work. The Line I tried was:

sElement = WBSStructure.WorkProduct(inx).Element(iny).Name

Below is a simplified version of the element class, and the workproduct is
similar. I noticed in order to get that nice Illisense I needed to have the
function return cElement, but that is causing an error when i try to retunr
anything other than the class object. Any help would be appreciated, as
Chip's taught me enough to get myself in trouble (No offense Chip :P)

Private pNameWP As String
Private pElementsWP As New Collection

Property Let Name(S As String)
pNameWP = S
End Property

Property Get Name() As String
Name = pNameWP
End Property

Public Function Element(index As Integer) As cElement

If index > pElementsWP.Count Or index < 1 Then
Err.Raise 9
Else
Element = pElementsWP(index)
End If

End Function
--
*********************
J Streger
MS Office Master 2000 ed.
MS Project White Belt 2003

 
Reply With Quote
 
 
 
 
=?Utf-8?B?VmVyZ2VsIEFkcmlhbm8=?=
Guest
Posts: n/a
 
      22nd Mar 2007
J,

Because your Element function is returning an object, instead of this way

Element = pElementsWP(index)

try it this way

set Element = pElementsWP(index)


--
Hope that helps.

Vergel Adriano


"J Streger" wrote:

> I have several Class modules set up, each representing a larger scope than
> the next, so they tier into each other. I was trying to get a string and
> couldn't get it to work. The Line I tried was:
>
> sElement = WBSStructure.WorkProduct(inx).Element(iny).Name
>
> Below is a simplified version of the element class, and the workproduct is
> similar. I noticed in order to get that nice Illisense I needed to have the
> function return cElement, but that is causing an error when i try to retunr
> anything other than the class object. Any help would be appreciated, as
> Chip's taught me enough to get myself in trouble (No offense Chip :P)
>
> Private pNameWP As String
> Private pElementsWP As New Collection
>
> Property Let Name(S As String)
> pNameWP = S
> End Property
>
> Property Get Name() As String
> Name = pNameWP
> End Property
>
> Public Function Element(index As Integer) As cElement
>
> If index > pElementsWP.Count Or index < 1 Then
> Err.Raise 9
> Else
> Element = pElementsWP(index)
> End If
>
> End Function
> --
> *********************
> J Streger
> MS Office Master 2000 ed.
> MS Project White Belt 2003
>

 
Reply With Quote
 
=?Utf-8?B?SiBTdHJlZ2Vy?=
Guest
Posts: n/a
 
      23rd Mar 2007
OK, now I feel kinda foolish. Thanks.

--
*********************
J Streger
MS Office Master 2000 ed.
MS Project White Belt 2003



"Vergel Adriano" wrote:

> J,
>
> Because your Element function is returning an object, instead of this way
>
> Element = pElementsWP(index)
>
> try it this way
>
> set Element = pElementsWP(index)
>
>
> --
> Hope that helps.
>
> Vergel Adriano
>
>
> "J Streger" wrote:
>
> > I have several Class modules set up, each representing a larger scope than
> > the next, so they tier into each other. I was trying to get a string and
> > couldn't get it to work. The Line I tried was:
> >
> > sElement = WBSStructure.WorkProduct(inx).Element(iny).Name
> >
> > Below is a simplified version of the element class, and the workproduct is
> > similar. I noticed in order to get that nice Illisense I needed to have the
> > function return cElement, but that is causing an error when i try to retunr
> > anything other than the class object. Any help would be appreciated, as
> > Chip's taught me enough to get myself in trouble (No offense Chip :P)
> >
> > Private pNameWP As String
> > Private pElementsWP As New Collection
> >
> > Property Let Name(S As String)
> > pNameWP = S
> > End Property
> >
> > Property Get Name() As String
> > Name = pNameWP
> > End Property
> >
> > Public Function Element(index As Integer) As cElement
> >
> > If index > pElementsWP.Count Or index < 1 Then
> > Err.Raise 9
> > Else
> > Element = pElementsWP(index)
> > End If
> >
> > End Function
> > --
> > *********************
> > J Streger
> > MS Office Master 2000 ed.
> > MS Project White Belt 2003
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What should I name my business classes given that LINQ data classes takes all table names? Ronald S. Cook Microsoft C# .NET 2 24th Jun 2008 02:57 AM
How i list or enumerate classes (names of classes in string format) from a certain namespace? please help. Jose Michael Meo R. Barrido Microsoft VB .NET 1 31st Dec 2004 12:13 PM
How i list or enumerate classes (names of classes in string format) from a certain namespace? please help. Jose Michael Meo R. Barrido Microsoft Dot NET 1 31st Dec 2004 12:13 PM
hot to differentiate outer classes and nested classes in late binding Daniel Microsoft Dot NET 0 20th Dec 2004 09:53 PM
Managed __value type enums and classes inside __nogc classes Edward Diener Microsoft VC .NET 0 20th Jan 2004 04:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:13 PM.