fudgekitten
asked on
Initializing structure variables
Hello!
I have a structure:
Public Structure geardrive
Public name As String
Public gearaxis As Integer
Public axison As Boolean
Public speed As Double
Public target As Double
End Structure
and I initialize:
Dim planets() As geardrive
The help files say I can initialize the variables on the same line, like this:
planets().name = {"Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"}
but it give me an error under the parentheses: number of indeces is less than number of dimensions
and an error under the first bracket: Expression expected.
If I do it individually, it works: planets(0).name = "mercury"
What am I doing wrong in the same line version?
Thanks,
Joy
I have a structure:
Public Structure geardrive
Public name As String
Public gearaxis As Integer
Public axison As Boolean
Public speed As Double
Public target As Double
End Structure
and I initialize:
Dim planets() As geardrive
The help files say I can initialize the variables on the same line, like this:
planets().name = {"Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"}
but it give me an error under the parentheses: number of indeces is less than number of dimensions
and an error under the first bracket: Expression expected.
If I do it individually, it works: planets(0).name = "mercury"
What am I doing wrong in the same line version?
Thanks,
Joy
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.