Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. ArrayList array

ArrayList array

Scheduled Pinned Locked Moved ASP.NET
helpquestioncomdata-structures
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    savaskulah
    wrote on last edited by
    #1

    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

    M 1 Reply Last reply
    0
    • S savaskulah

      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

      M Offline
      M Offline
      Mike Ellison
      wrote on last edited by
      #2

      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 returning null. Is the "txtbox__" name correct? Are the textboxes deeper in some Controls collection of a specific control? If the latter is true, you may want to use the FindControl method of the container control instead of that of the Page.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups