Combo box values from array generated with table value using DataTable.Rows(index)("fieldname")

I cannot get my combo box to populate with an array that is based on a string in a table I use.

dt is the DataTable
index is a string that contains the index number from a DataRow
array_value is the field name that contains the text     {"", "Mr.", "Mrs.", "Dr."}

       Dim arrCriteria1() As String = dt.Rows(index)("array_value")
       cboCriteria1.DataSource = arrCriteria1

Regardless of what I do I continue to get a "specified cast is not valid" error.

I can however see that dt.Rows(index)("array_value") contains an appropriate value using MsgBox.
I also took the '{}' characters out of the array_value string and set up the command as follows:

       Dim arrCriteria1() As String = {dt.Rows(index)("array_value")}

It displayed the whole string..."", "Mr.", "Mrs.", "Dr."....as cboCriteria1.Text
I'm assuming it has to do with a conversion.  But I am without the knowledge of it.
This is a critical form in my design.  Without this capability I'm dead in the water.

Thanks for any help!

TSFLLCAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

PockyMasterCommented:
Check the Length of your string array. It probably says 1, because the value you are providing is just a string that looks like an array.

To make it into an array use Split like e.g.

    Dim a As String = """test"",""test2"",""test3""" ' example data like you are providing now

    Dim ar() As String = a.Split(","c) ' split the data on the comma

You might want to replace the " with nothing later, but I let that up to your imagination
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
TSFLLCAuthor Commented:
That worked like a charm!

My arrays in this form contain a limited number of values.

Therefore, I did remove the quotations altogether.  I also included in empty string for the first value so that no values would display in
my newly defined combo box.

Thanks much!
0
PockyMasterCommented:
You're welcome!
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
Visual Basic.NET

From novice to tech pro — start learning today.