ArrayList array
-
protected ArrayList[] arrColl = new ArrayList[4]; .... .... for (int i=0; i < 4; i++) { for (int j=0; j < 9; j++) arrColl[i].Add((TextBox)FindControl("txtbox"+i.ToString()+j.ToString())); // ERROR:Object reference not set to an instance of an object. } ....... This error is reporting the run-time, not compile-time. How can i correct this error? Thanks for help. Savaş Külah savaskulah@msn.com
-
protected ArrayList[] arrColl = new ArrayList[4]; .... .... for (int i=0; i < 4; i++) { for (int j=0; j < 9; j++) arrColl[i].Add((TextBox)FindControl("txtbox"+i.ToString()+j.ToString())); // ERROR:Object reference not set to an instance of an object. } ....... This error is reporting the run-time, not compile-time. How can i correct this error? Thanks for help. Savaş Külah savaskulah@msn.com
Hi there. On first glance, I would check to make sure that
FindControl("txtbox"+i.ToString()+j.ToString())
was returning a valid control and not
null
... I would guess it is returningnull
. Is the "txtbox__" name correct? Are the textboxes deeper in someControls
collection of a specific control? If the latter is true, you may want to use theFindControl
method of the container control instead of that of thePage
.