Drstein99 Posted February 23, 2004 Posted February 23, 2004 If I dim an array, and don't know how many items I'm going to use how's the best approach? I know dimming something 1/2 way though the function will complete my task, and I also know it's frowned upon as sloppy. I've included some sample code to get an idea of what i'm 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 Quote www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
Moderators Robby Posted February 23, 2004 Moderators Posted February 23, 2004 Once the array is declared use the keyword Redim and or Preserve Redim nsPanel(10) Quote Visit...Bassic Software
*Experts* Bucky Posted February 23, 2004 *Experts* Posted February 23, 2004 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(). Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.