473,383 Members | 1,805 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Array Differences as Parameters

[Pardon the crosspost, but it's warranted: A97/VBA5 & MapPoint2004]
Is there a difference in populating arrays between the following two
fashions?

EXAMPLE 1
varColors = Array("Blue", "Yellow", "Red")

EXAMPLE 2
rstColors = "tblColors" (which is populated with one record for each
color)

For intX = 1 to rstColors.RecordCount
varColors(intX) = rstColors!Color (assume array is properly dim'd)
rstColors.MoveNext
Next intX

Has anyone ran into difficulty with passing an array into a procedure's
parameter (that calls for an array)? I'm trying to do some automation
with MapPoint, and am running into the issue where Example 1 is the
ONLY method that works. (For those who've used MP, I'm passing the
array to the ArrayOfCustomFields parameter in DisplayDataMap.)

I've noticed in the immediate pane that the two methods populate
slightly differently so that the "Type" in Ex#1 shows "Variant/Variant"
and #2 just shows "Variant". Beyond that, I see no difference.

I'm ardent against ugly code. For this procedure, it's not just a
simple text string I'm passing but instead an ugly calculation, causing
(with line continuations) eight blocky lines of code. I'd much rather
a nice clean loop to populate the array, but MP refuses to use it.

Help appreciated in advance.

Thanks,
Anthony.

Nov 13 '05 #1
2 1623
What error are you receiving? And what method in MP are you calling?

I believe Arrays are 0 Based, which means the first element in example1 is
varColors(0) = "Blue"
in example 2, the first element varColors(0) = ""
for your example 2 loop try:

dim intX as integer
do until rstColors.eof
varColors(intX) = rstColors!Color (assume array is properly dim'd)
intX=intX+1
rstColors.MoveNext
loop

<ac*******@railvan.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
[Pardon the crosspost, but it's warranted: A97/VBA5 & MapPoint2004]
Is there a difference in populating arrays between the following two
fashions?

EXAMPLE 1
varColors = Array("Blue", "Yellow", "Red")

EXAMPLE 2
rstColors = "tblColors" (which is populated with one record for each
color)

For intX = 1 to rstColors.RecordCount
varColors(intX) = rstColors!Color (assume array is properly dim'd)
rstColors.MoveNext
Next intX

Has anyone ran into difficulty with passing an array into a procedure's
parameter (that calls for an array)? I'm trying to do some automation
with MapPoint, and am running into the issue where Example 1 is the
ONLY method that works. (For those who've used MP, I'm passing the
array to the ArrayOfCustomFields parameter in DisplayDataMap.)

I've noticed in the immediate pane that the two methods populate
slightly differently so that the "Type" in Ex#1 shows "Variant/Variant"
and #2 just shows "Variant". Beyond that, I see no difference.

I'm ardent against ugly code. For this procedure, it's not just a
simple text string I'm passing but instead an ugly calculation, causing
(with line continuations) eight blocky lines of code. I'd much rather
a nice clean loop to populate the array, but MP refuses to use it.

Help appreciated in advance.

Thanks,
Anthony.
Nov 13 '05 #2
Sorry, was a typo, only because I've tried both 0-based and 1-based
arrays.

Either way: "The parameter is incorrect."

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Daniel | last post by:
Hi, Are there any differences between C# and VB.Net besides syntax? Performance-wise, how do they compare? Thanks, Dan
6
by: brian_mckracken | last post by:
This might not be the right group for this question, since its kind of a pure html question... Given the html construct: <form action='index.php?expand=0,10000' method='post'> Email: <input...
1
by: Samuel R. Neff | last post by:
Are there any differences between using Array.Length and Array.GetUpperBound(0) on a one-dimensional array? We have a team of developers and most people use Array.Length but one developer uses...
21
by: yeti349 | last post by:
Hi, I'm using the following code to retrieve data from an xml file and populate a javascript array. The data is then displayed in html table form. I would like to then be able to sort by each...
4
by: entitledX | last post by:
Hi, I'm trying to use the HDF library to read a few HDF files that I need to process. The data in each file varies in rows, but the columns remain constant. Because of that, I had dynamically...
3
by: danbraund | last post by:
Hi everyone, I'm a long time C coder, who is coding his final year project in C++ to run under the MIT click routing system. Being fairly new to the OO side of the language, my problem is this: ...
11
by: blangela | last post by:
I am teaching a C programming course to C++ programmers and want to come up with list of _KEY_ differences between the two languages. Below is a list I have come up with so far. Have I missed any?...
45
by: anto frank | last post by:
hi friends, is ther any difference in array in c and array in c++?
1
by: neoblitz | last post by:
Hi Guys, I'm very new to NuSoap. I'm able to call a webservice which actually returned me results.. But I'm having trouble to read the response or I simply don't understand how to read the response.....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.