Solved

Initializing structure variables

Posted on 2008-06-19
1
133 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

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month11 days, 15 hours left to enroll

623 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