Hi all. I have a problem I have not been able to find a reference
about. I am using VB6 and am only a hobbyist programmer. I have 7
arrays of type MyData. Type MyData has 23 elements. Which array that
is operated on depends on 1 of 7 options Currently if I want to write
to an array I have to do this:
if opt1 then
array1(x).data1 = 36
array1(x).data2 = 23
..
array1(x).data2 3= 69
else
if opt2 then
array2(x).data1 = 43
array2(x).data2 =77
..
array2(x).data2 3 =44
else
if opt3 then
array3(x).data1 = 78
array3(x).data2 = 63
..
array3(x).data2 3 =22
end if
end if
end if
I would like to use a shorter routine to write/read these arrays
rather than go through 7 long if statements. Perhaps something like
below that would pick the array to write to:
sub write (array to use)
array(x).data1= 36
array(x).data2= 23
..
array(x).data23 = 69
end sub
Is there a way to do this?
Thanks in advance
John
about. I am using VB6 and am only a hobbyist programmer. I have 7
arrays of type MyData. Type MyData has 23 elements. Which array that
is operated on depends on 1 of 7 options Currently if I want to write
to an array I have to do this:
if opt1 then
array1(x).data1 = 36
array1(x).data2 = 23
..
array1(x).data2 3= 69
else
if opt2 then
array2(x).data1 = 43
array2(x).data2 =77
..
array2(x).data2 3 =44
else
if opt3 then
array3(x).data1 = 78
array3(x).data2 = 63
..
array3(x).data2 3 =22
end if
end if
end if
I would like to use a shorter routine to write/read these arrays
rather than go through 7 long if statements. Perhaps something like
below that would pick the array to write to:
sub write (array to use)
array(x).data1= 36
array(x).data2= 23
..
array(x).data23 = 69
end sub
Is there a way to do this?
Thanks in advance
John
Comment