Posted on 2005-04-24
Last Modified: 2012-05-05
Im trying to populate an array i set up

if not IsPostBack Then

dim books(3) as string
books(0) = "first book"
books(1) = "second book"
books(2) = "third"
books(3) = "fourth"

'populate the list

dim i as integer

for i=0 to books.GetLength(0) -1

ddl.Items.Add(new ListItem(books(i,0),books(i,1)))  <----------------

on this line I get: BC30106: Number of indices exceeds the number of dimensions of the indexed array.
Question by:dprasad
    1 Comment
    LVL 9

    Accepted Solution

    The problem is in the below line

    ddl.Items.Add(new ListItem(books(i,0),books(i,1)))  

    you have declared the array books(3) which means that its a one dimensional array but you are trying to access it like a two dimensional array by saying books(i,0) you should change it to books(i)

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
    IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now