dim arrays help

Drstein99

Well-known member
Joined
Sep 26, 2003
Messages
283
Location
Audubon, Nj
If I dim an array, and dont know how many items Im going to use hows the best approach? I know dimming something 1/2 way though the function will complete my task, and I also know its frowned upon as sloppy.

Ive included some sample code to get an idea of what im working with. Please advise thanks.


Dim nsPanel() As StatusBarPanel
Dim nsPanel1 As New StatusBarPanel


nsPanel1.AutoSize = StatusBarPanelAutoSize.Contents

nsPanel1.Text = "Goal Sales: 123"
nsPanel(0) = nsPanel1
 
I myself like to use an ArrayList class to manage arrays or
collections. That way you can easily add, remove and reorder
items. If you wanted to add all the panels in the ArrayList
to a panel control using, say, StatusBar.Panels.AddRange(),
you could always create an array out of the ArrayList by using
ArrayList.ToArray().
 
Back
Top