Re: Can't Figure Out How to Access a List Item




<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.

- - - - -


.



Relevant Pages

  • Re: ListBox question
    ... This is similar to the way a context menu behave. ... I want to use the ListBox as a validation list since I had some ... This means that your "hot cursor" ... this would mean the user could be selecting or, worse yet, ...
    (microsoft.public.excel.programming)
  • Re: ListBox question
    ... I'm not sure how to do what you are asking off the top of my head, but I do see a problem with what you want to do. ... This means that your "hot cursor" would trigger even if the user accidentally brushed his/her cursor across the ListBox... ... this would mean the user could be selecting or, worse yet, changing a selection without even realizing they did so. ...
    (microsoft.public.excel.programming)
  • help with common dialog for multiple file insert please
    ... I wrote some code to let me select multiple files, ... For the common dialog stuff I used the code kindly ... the first entry in the listbox is the ... entry and the second as the file name even when only selecting ...
    (microsoft.public.word.vba.general)
  • RE: Report via List Box
    ... If the users are not selecting the records in the listbox then you are ... Microsoft Access Support ... Microsoft Security Bulletin MS03-026? ...
    (microsoft.public.access.macros)
  • Re: Listbox vertical scroll position capture
    ... so you've got to preserve the scroll location without re-selecting any item in the listbox. ... I don't think I've ever seen any Javascript that can do that, but I'm not a Javascript guru. ... I select from the "Source" list box, add the item to a "Destination" list box and remove the item that was selected from the "Source" listbox. ... How do I scroll as if I am a user scrolling without selecting anything. ...
    (microsoft.public.dotnet.framework.aspnet)