Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

arrays

Posted on 2005-04-24
1
Medium Priority
?
251 Views
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.
0
Comment
Question by:dprasad
1 Comment
 
LVL 9

Accepted Solution

by:
checoo earned 2000 total points
ID: 13856075
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)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Screencast - Getting to Know the Pipeline
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

575 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