Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 24th, 2008, 12:05 AM
Friend of Wrox
 
Join Date: Mar 2008
Location: So Cal is good enough for you, California, USA.
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?

  #2 (permalink)  
Old June 24th, 2008, 12:34 AM
Friend of Wrox
 
Join Date: Mar 2008
Location: So Cal is good enough for you, California, USA.
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...

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 06:17 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.