Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42215

VS 2008 [RESOLVED] VB dynamic array from objects

$
0
0
Hi,

I'm working on some automation for MS Reporting services and I have following problem, I need to convert array of objects into array of object with dynamic size.

Original working code is:

Dim parameters(2) As parametervalueorfieldreference


Dim parameter1 As New parameterfieldreference()
parameter1.parametername = "value1"
parameters(0) = parameter1

Dim parameter2 As New parameterfieldreference()
parameter2.parametername = "value2"
parameters(1) = parameter2

Dim parameter3 As New parameterfieldreference()
parameter3.parametername = "value3"
parameters(2) = parameter3

What I'm aiming is (in presudo-code) to do this:

Dim parameters() As parametervalueorfieldreference
Redim parameter2(some_size)
for i = 0 to some_size
parameter2(i).parametername= some_other_string_variable
next

however, this basically does not work (no error message in general, only that later, when I use parameter2 in one API function, i get information that this is incorrect structure)
I have tried to use this: CType(parameter2(i), ParameterFieldReference).ParameterName = some_other_string_variable

however same issue.

and as my knowledge of VB.net is limited, can please somebody help me?

Thank you

Viewing all articles
Browse latest Browse all 42215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>