Create an array

Hi,

I need to populate the array with Question_id datafield then display the array result.

   Dim GetQuestId As New ArrayList()
   Dim i As Integer = 0
            While reader.Read
                strQuestions.Append("<tr>")
                strQuestions.Append("<td>" & reader("Question")  & "</td>")
               strQuestions.Append("</td>")
                strQuestions.Append("</tr>")
                GetQuestId.Add(Integer.Parse(reader("Question_ID")))
                i = i + 1
            End While

now here I need to print in the msgbox the array GetQuestId.
I don't know if I have created and populated the array correctly.
             'MsgBox(parse.integer(GetQuestid))
Thanks,

KS_MisAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jorge PaulinoIT Pro/DeveloperCommented:
Hi KS_Mis,

Why are you doing that (what you need) ? That's not going to work.

Why don't you use a stringbuilder

Dim sb As New StringBuilder
sb.Append("yourtext")
msgbox sb.ToString()

jpaulino
0
KS_MisAuthor Commented:
I have to use an array so I can insert the array to the table one item on a time
0
Jorge PaulinoIT Pro/DeveloperCommented:
KS_Mis,

And why don't you insert in the end of the loop ?

jpaulino
0
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Jorge PaulinoIT Pro/DeveloperCommented:
Hi mean

         While reader.Read
                ' insert here
            End While
0
KS_MisAuthor Commented:
no that's not going to work.
I need help creating an array then populate the array with the question_id then display the result
of the array.

once I have this step done then I would have to loop through the array to insert each record into the
table.
0
Jorge PaulinoIT Pro/DeveloperCommented:
Ok, you must only fill the array with the values. And you can do it this way:

            Dim GetQuestId As New ArrayList()
            While reader.Read
                GetQuestId.Add(Integer.Parse(reader("Question_ID")))
            End While

           ' Shows the data in the array
            For x As Integer = 0 To a.Count - 1
                MsgBox(a(x).ToString)
            Next

If you need to store reader("Question")  and reader("Question_ID") you can build two arrays
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KS_MisAuthor Commented:
Excellent. Thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development Software

From novice to tech pro — start learning today.