?
Solved

Hard Code Values to an Array

Posted on 2009-03-29
3
Medium Priority
?
626 Views
Last Modified: 2012-05-06
Hi EE.

I am not great with regular arrays, but I am attempting to create an array that will hold values a.b.c.d.e.f etc. depending on how many columns I have.
I retrieve the number of columns and then assign it to the array, but how do I assign the a,b,c etc. to the array  and how do I pick the values out?
Thanks
Dim cc As Integer = Me.fpGrdGeneric.ActiveSheet.ColumnCount - 1
 Dim arr(cc) As Array = a,b,c,??

Open in new window

0
Comment
Question by:Sheritlw
3 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 24016730
maybe some tips as described here may help? http://www.vb-helper.com/howto_net_declare_arrays.html
0
 
LVL 6

Accepted Solution

by:
HarryNS earned 1000 total points
ID: 24016752
Dim Test() As Integer
        Test = New Integer() {1, 3, 5, 7, 9}

        Dim Test1() As String
        Test1 = New String() {"a", "b", "c", "d"}
0
 
LVL 48

Assisted Solution

by:Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs) earned 1000 total points
ID: 24016781
For a start, you need to declare it as String, as the way you have it is declaring an array of Arrays.

Then you need to fill it like this....

        Dim arr(cc) As String
        For c As Integer = 0 To cc - 1
            arr(c) = Chr(65 + c).ToString
        Next

Wayne
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

850 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