Solved

Hard Code Values to an Array

Posted on 2009-03-29
3
511 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Changing the Source of an ADO Recordset while it's open 4 26
Showdialog 8 21
VB.NET HttpWebRequest 12 34
Close word object 13 24
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
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.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 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

11 Experts available now in Live!

Get 1:1 Help Now