473,324 Members | 2,268 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Array Declaration. Simple Question. Thanks.

Hello,

I have this array:

Dim myArray() As String = {"A", "B", "C", "D", "E", "F"}

However I need to declare the array and assign the values in different
places of my code so I have:

Dim myArray() As String
....
myArray() = {"A", "B", "C", "D", "E", "F"}

The second line not working.

Can someone tell me why?

Thanks,
Miguel
Nov 19 '05 #1
4 1245
You have to give your array a size or initial values then assign values
using index...
in [C#]
string[] myArray = new string[size];
or
string[] myArray = {"A","B","C"};

then use the index to assign values..
myArray[0] = "A";
myArray[1] = "B";
.................................................. ......

"Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
news:O8*************@TK2MSFTNGP12.phx.gbl...
Hello,

I have this array:

Dim myArray() As String = {"A", "B", "C", "D", "E", "F"}

However I need to declare the array and assign the values in different
places of my code so I have:

Dim myArray() As String
...
myArray() = {"A", "B", "C", "D", "E", "F"}

The second line not working.

Can someone tell me why?

Thanks,
Miguel

Nov 19 '05 #2
Yes, I can. And I did. Twice now. In detail. See your previous post.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

"Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
news:O8*************@TK2MSFTNGP12.phx.gbl...
Hello,

I have this array:

Dim myArray() As String = {"A", "B", "C", "D", "E", "F"}

However I need to declare the array and assign the values in different
places of my code so I have:

Dim myArray() As String
...
myArray() = {"A", "B", "C", "D", "E", "F"}

The second line not working.

Can someone tell me why?

Thanks,
Miguel

Nov 19 '05 #3
Thanks,

There was some mistake in my code I didn't see.

Thanks,
Miguel

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:ke***@DIESPAMMERSDIEtakempis.com:
Yes, I can. And I did. Twice now. In detail. See your previous post.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

"Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
news:O8*************@TK2MSFTNGP12.phx.gbl...
Hello,

I have this array:

Dim myArray() As String = {"A", "B", "C", "D", "E", "F"}

However I need to declare the array and assign the values in different
places of my code so I have:

Dim myArray() As String
...
myArray() = {"A", "B", "C", "D", "E", "F"}

The second line not working.

Can someone tell me why?

Thanks,
Miguel


Nov 19 '05 #4
No problemo, Miguel. We all need a second pair of eyes now and then!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

"Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
news:eP**************@TK2MSFTNGP09.phx.gbl...
Thanks,

There was some mistake in my code I didn't see.

Thanks,
Miguel

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:ke***@DIESPAMMERSDIEtakempis.com:
Yes, I can. And I did. Twice now. In detail. See your previous post.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

"Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
news:O8*************@TK2MSFTNGP12.phx.gbl...
> Hello,
>
> I have this array:
>
> Dim myArray() As String = {"A", "B", "C", "D", "E", "F"}
>
> However I need to declare the array and assign the values in different
> places of my code so I have:
>
> Dim myArray() As String
> ...
> myArray() = {"A", "B", "C", "D", "E", "F"}
>
> The second line not working.
>
> Can someone tell me why?
>
> Thanks,
> Miguel
>
>

Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Rafi Kfir | last post by:
Hi, This may look as a smiple task to most of you, but to me (a beginner with C), it drives me crazy. All I want is that one function passes a two dimensional array of strings to another...
1
by: Sam | last post by:
Hello all I have a two dimensional array (the dimensions are not known) that needs to be passed to fortran from c++, allocate the dimensions of the array in fortran code, do some filling up of...
9
by: joshc | last post by:
Hi, I have an array defined in one file with an intializer as follows: int arr = {0, 1, 2, 3}; I have a declaration of the array in another file as follows: extern int arr;
24
by: Michael | last post by:
Hi, I am trying to pass a function an array of strings, but I am having trouble getting the indexing to index the strings rather than the individual characters of one of the strings. I have...
19
by: DarelRex | last post by:
Is it possible to pass a 2-D, statically defined array? Here's a 1-D example that won't work: void foo() { int myArray ; bar(myArray); } void bar(int *arr) {
57
by: buuuuuum | last post by:
why array can't be assigned, like structs?
18
by: mdh | last post by:
>From p112 ( K&R). Given an array declared as static char arr= { { 0,1,........},{0,1,.....}}; let arr be passed as an argument to f. f( int (*arr) ) {....} It is noted that the...
2
by: Imran | last post by:
Hello all, I am trying to pass 2D array to a func, as follows, it is showing compiler error. void helloptr(int **a){ a = 0xB; } int main(int argc, char* argv){
31
by: mdh | last post by:
I am still having a problem understanding K&RII on p 112. I have looked at the FAQs --which I am sure answer it in a way that I have missed, so here goes. A 2-dim array, (per K&R) is really a...
4
by: Peskov Dmitry | last post by:
class simple_class { int data; public: simple_class() {data=10;}; simple_class(int val) : data(val){} }; int main() {
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.