Solved

Initializing structure variables

Posted on 2008-06-19
1
131 Views
Last Modified: 2010-04-30
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
0
Comment
Question by:fudgekitten
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 81

Accepted Solution

by:
zorvek (Kevin Jones) earned 385 total points
ID: 21828586
You can't do that and there is no convenient way to do what you want. Each member of the record and each record has to be set individually.

Kevin
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question