Re: Can't Figure Out How to Access a List Item
- From: "Steve Gerrard" <mynamehere@xxxxxxxxxxx>
- Date: Sun, 13 Aug 2006 08:42:14 -0700
<jecottrell65@xxxxxxxxx> wrote in message
news:1155481398.483264.214300@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
You might want to try
m_strMCUData = m_colMessages.Item(intMessagesForwarded + 1).Subject
That Worked! But somewhere in cleaning up my code I broke another part.
If allow this subroutine to get called, I get a run time error on the
For Each line complaining that 'Object doesn't support property or
method.'
I didn't change anything that I thought would have caused the problem.
And when it first came up I copy pasted the original example code back
into that sub and also the CMessages.cls.
...
In other words, some code in the CMessages.cls could fix the
requirement for explicitly calling the item property?
BTW, Steve, a sincere thanks for the assistance. I am always willing to offer
to pay for help when it
goes beyond a 'quick question or two...
Oh, the IRS tax implications of accepting money are just too grim :) But
seriously, those of us in CLBVM who answer questions do it because we enjoy it,
and are happy to find a poster who takes it seriously enough to answer back, to
struggle with it, and in the end to get somewhere.
The loss of For Each functionality and of Item as the default property are both
due to copying/pasting code, which does not copy attributes. These are stored in
the same file, but are not visible as part of the code.
- - - - -
For the default property, open the CMessages class file, and put your cursor on
the line
Public Property Get Item(vntIndexKey As Variant) As CMessage
Then click Tools, Procedure Attributes...
In the dialog box that pops up, click the Advanced button.
You should be seeing a listbox Name at the top, with Item selected, and a
listbox Procedure ID in the middle, with (None) selected.
Change the Procedure ID to (Default) by selecting it in the listbox. Click
Apply, then OK.
- - - - - -
To reactivate the For Each functionality, put your cursor on the line
Public Property Get NewEnum() As IUnknown
This is the enumerator, which is what gets each object in the for each loop.
Then click Tools, Procedure Attributes...
In the dialog box that pops up, click the Advanced button.
You should be seeing a listbox Name at the top, with NewEnum selected, and a
listbox Procedure ID in the middle, with (None) selected.
Change the Procedure ID to -4 by typing it in the listbox (it is not in the
dropdown list). Click Apply, then OK.
The -4 is a magic number that identifies this property as the enumerator. The
only official way to discover this that I know is to use the Class Wizard to
construct a new collection class, then to investigate the procedure IDs of the
methods it generates.
- - - - -
.
- Follow-Ups:
- Re: Can't Figure Out How to Access a List Item
- From: jecottrell65
- Re: Can't Figure Out How to Access a List Item
- References:
- Can't Figure Out How to Access a List Item
- From: jecottrell65
- Re: Can't Figure Out How to Access a List Item
- From: Steve Gerrard
- Re: Can't Figure Out How to Access a List Item
- From: jecottrell65
- Re: Can't Figure Out How to Access a List Item
- From: Steve Gerrard
- Re: Can't Figure Out How to Access a List Item
- From: jecottrell65
- Re: Can't Figure Out How to Access a List Item
- From: Steve Gerrard
- Re: Can't Figure Out How to Access a List Item
- From: jecottrell65
- Re: Can't Figure Out How to Access a List Item
- From: Steve Gerrard
- Re: Can't Figure Out How to Access a List Item
- From: jecottrell65
- Re: Can't Figure Out How to Access a List Item
- From: Steve Gerrard
- Re: Can't Figure Out How to Access a List Item
- From: jecottrell65
- Can't Figure Out How to Access a List Item
- Prev by Date: Re: Can't Figure Out How to Access a List Item
- Next by Date: Re: Can't Figure Out How to Access a List Item
- Previous by thread: Re: Can't Figure Out How to Access a List Item
- Next by thread: Re: Can't Figure Out How to Access a List Item
- Index(es):
Relevant Pages
|