Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How do I delete an element of a Class?

Posted on 2003-03-02
2
Medium Priority
?
140 Views
Last Modified: 2010-05-01
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
0
Comment
Question by:bomax
  • 2
2 Comments
 

Expert Comment

by:Cairotes
ID: 8053255
set omes=nothing.

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

Accepted Solution

by:
Cairotes earned 150 total points
ID: 8053269
Oh, you can remove completely by doing m_colmessages.remove. It will erase the object from the collection. You will need to play a little bit for the for i=1 to ... since the deletion affects the collection count property.
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question