Solved

Hard Code Values to an Array

Posted on 2009-03-29
3
516 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 250 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 47

Assisted Solution

by:Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs) earned 250 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Spacing between controls 4 30
Want to create a userform that looks like the image provided 10 44
Exit the loop 4 35
Get Client IP on RDS - VB.NET 15 27
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

920 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

15 Experts available now in Live!

Get 1:1 Help Now