Thread: Array Help
View Single Post
  #2 (permalink)  
Old 04-24-2008, 07:41 PM
gaylo565's Avatar   
gaylo565 gaylo565 is offline
Programmer
 
Join Date: May 2007
Location: flagstaff, az
Posts: 184
Last Blog:
String Manipulation wi...
Credits: 122
Rep Power: 9
gaylo565 is a jewel in the roughgaylo565 is a jewel in the roughgaylo565 is a jewel in the rough
Default Re: Array Help

I think your problem is that the array is never set to a static number of rows. You can have a dynamic array but you must have an initial value when you start using the array.

" string[][] fileByWord = new string[findNumberOfLines()][];"

where u instantiate the array u can put a 0 for the # of rows and then it will set its own value as you add records...it should end up largest split length that the file has...I hope this helps some and someone let me know if i'm way off
ps...i didnt try to see if it worked cuz i have VS 2003 wich doesn't contain the collections.generic namespace.

another thing is u set an int for the array length but don't use it in your for statement. I dont think this is responsible for the error message your getting but it could cause another 1

Last edited by gaylo565; 04-24-2008 at 07:51 PM. Reason: afterthought
Reply With Quote