Autofreak
asked on
loading an array
Hi Guys,
Is it possible to load an array in VB the way itcam be done in C#,
int[] myArray = {1,4,6,7,8,9,0,7};
Thanks
Serge
Is it possible to load an array in VB the way itcam be done in C#,
int[] myArray = {1,4,6,7,8,9,0,7};
Thanks
Serge
ASKER
What if it's two_dimensional?
Serge
Serge
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
myarray = Array(Array(1, 2, 3, 4),Array(5, 6, 7, 8),Array(9, 10, 11, 12), _
Array(13, 14, 15, 16))
Array(13, 14, 15, 16))
ASKER
Cool
How do I retrieve myArray(0,1) in one line?? It does't onderstand this syntax.
Thanks
Serge
How do I retrieve myArray(0,1) in one line?? It does't onderstand this syntax.
Thanks
Serge
You told the answer yourself !!
myArray(0,1)
!!
myArray(0,1)
!!
Oh.. sorry.. you should use
myArray(0)(1)
to get 2 (1st row, 2nd column)
Usually 0,1 is used. However, in this case, we are using a variant to act as an array. So, we should use this syntax.
myArray(0)(1)
to get 2 (1st row, 2nd column)
Usually 0,1 is used. However, in this case, we are using a variant to act as an array. So, we should use this syntax.
ASKER
Damn it,
the functions that recieve the values from the array compalin on argument type mismatch ,
is there a function to convert a variant into a string?
Serge
the functions that recieve the values from the array compalin on argument type mismatch ,
is there a function to convert a variant into a string?
Serge
Are you using VB6 or Vb.Net?
what exactly are you storing ?
Idle_Mind, if it were VB.NET, then he could have assigned it directly, as in C#
I think it is VB 6.
I think it is VB 6.
Right...with slight differences in syntax.
I just wanted to be sure. =)
I just wanted to be sure. =)
:)
if you needed it:
string = CStr(varient)
string = CStr(varient)
ASKER
Sorry Guys, So distracted I was, eXcellent tips,
Cheers
Serge
Cheers
Serge
myArray = Array(1,4,6,7,8,9,0,7)
However, myArray must be of Variant type.
---
Harish