Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 24th, 2008, 12:05 AM
Friend of Wrox
 
Join Date: Mar 2008
Posts: 133
Thanks: 15
Thanked 1 Time in 1 Post
Send a message via ICQ to iceman90289 Send a message via AIM to iceman90289
Default ArrayList Variable Holding Array

i have a variable that is declared like so:
ArrayList SubDirArray = new ArrayList();

and i have a function that puts all the folders in one directory into an array:
public ArrayList ShowFolders(string SearchPat)
        {
            // lists all sub-folders in a folder
            ArrayList alFolders = new ArrayList();
            foreach (DirectoryInfo dinfo in m_dir.GetDirectories(SearchPat))
            {
                alFolders.Add(dinfo.Name);
            }
            return alFolders;
        }

Now i try and assign the value of the instance method to my SubDirArray:
SubDirArray = ListObj.ShowFolders();

i dont think the SubDirArray is being filled up with the elements that are returned from ShowFolders() because when i try to use a for loop to print the elements to a console window, nothing shows up...
how do i get SubDirArray to fill up with the returning value of ShowFolders?

 
Old June 24th, 2008, 12:34 AM
Friend of Wrox
 
Join Date: Mar 2008
Posts: 133
Thanks: 15
Thanked 1 Time in 1 Post
Send a message via ICQ to iceman90289 Send a message via AIM to iceman90289
Default

ok so i figured out what i did wrong... yeah...
SubDirArray can be directly assigned the value of another ArrayList array...






Similar Threads
Thread Thread Starter Forum Replies Last Post
convert arraylist into array mohitbhutani C# 2 June 14th, 2011 04:00 AM
xsl:variable holding name of an xsl:param perissos XSLT 0 December 5th, 2006 07:09 AM
how to let the page holding for a few seconds walgr2k ASP.NET 2.0 Basics 1 May 19th, 2006 01:55 PM
Saving data from an array into a variable cutovoi Excel VBA 1 January 7th, 2004 10:09 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.