Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>How about creating a <strong>collection</strong> of <code>NewCycle</code> objects to which you can dynamically add new items, modify any of the existing items, and remove any of the existing items from code while your application is running? You easily implement this using a <code>List(Of T)</code>. Just change your variable declaration to:</p> <pre><code>Public cycles As List(Of NewCycle) </code></pre> <p>The <a href="http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx" rel="nofollow noreferrer">documentation</a> for the <code>List(Of T)</code> class contains a fairly comprehensive example of how to use this collection, and lists the methods you'll need to use in order to manipulate the objects in the list.</p> <p>If you need to handle events for each of the items in the class, you could consider creating your own custom collection and overriding the <code>Add</code> and <code>Remove</code> methods to <a href="http://msdn.microsoft.com/en-us/library/6yyk8z93.aspx" rel="nofollow noreferrer">dynamically add and remove event handlers</a> for the events raised by that object. In other words, each time a <code>NewCycle</code> item is added to your cycle collection, you can add an event handler for its <code>bla</code> method using <code>AddHandler</code>, and each time an item is removed, you can remove the event handler for its <code>bla</code> method using <code>RemoveHandler</code>. All of the objects' events can be handled by a single event handler method, rather than having one for each object. See the answers to <a href="https://stackoverflow.com/questions/1299920">this question</a> for more on how to do that.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload