bomax
asked on
How do I delete an element of a Class?
I have a class with Message type in it.
I use:
Dim oMes As CMessage
to declare it. Then I use
For Each oMes In m_colMessages
to loop through the ones I have. How can I delete a certain oMes within that FOR EACH loop? I tried setting it equal to nothing, as in:
oMes=""
but it errored...thanks
I use:
Dim oMes As CMessage
to declare it. Then I use
For Each oMes In m_colMessages
to loop through the ones I have. How can I delete a certain oMes within that FOR EACH loop? I tried setting it equal to nothing, as in:
oMes=""
but it errored...thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The better will be inside a for i=1 to m_colmessages.count
set m_colmessages(i-1)=nothing
It is safer.
The above implies the m_colmessages is a collection which I guess it is from your code extract.