473,434 Members | 1,395 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,434 software developers and data experts.

Testing to see if an array has been initialised

Ray
Here's the code example...

Dim myArray() as string

later I will redim the array in a for/next or a Do/While Loop

x = ubound(myArray) +1 <<< causes error 9 if no elements exist
already!
redim Preserve myArray(x)

Here's the question... how do I test the array to see if it was already
initialised without trapping Error 9 (array not initialised)?
I have tried IsArray(myArray) and that returns TRUE and I have tried a whole
bunch of others IsEmpty etc etc

Any help appreciated

Ray
Jul 17 '05 #1
1 2624
I just posted answer to this same question in another newsgroup. Please
consider the following...

From a post by Jeff Johnson:

"You have posted this question individually to multiple groups. This is
called Multiposting and it's BAD. Replies made in one group will not be
visible in the other groups, which may cause multiple people to respond to
your question with the same answer because they didn't know someone else had
already done it. This is a waste of time.

If you MUST post your message to multiple groups, post a single message and
select all the groups (or type their names manually, separated by commas) in
which you want it to be seen. This is called Crossposting and when used
properly it is GOOD."

Rick - MVP
"Ray" <ne********@quitealright.com> wrote in message
news:Hl*****************@news.indigo.ie...
Here's the code example...

Dim myArray() as string

later I will redim the array in a for/next or a Do/While Loop

x = ubound(myArray) +1 <<< causes error 9 if no elements exist
already!
redim Preserve myArray(x)

Here's the question... how do I test the array to see if it was already
initialised without trapping Error 9 (array not initialised)?
I have tried IsArray(myArray) and that returns TRUE and I have tried a whole bunch of others IsEmpty etc etc

Any help appreciated

Ray

Jul 17 '05 #2

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

Similar topics

7
by: Christopher Jeris | last post by:
I am relatively new to JavaScript, though not to programming, and I'm having trouble finding the idiomatic JS solution to the following problem. I have a table with (say) fields f1, f2, f3. I...
5
by: Denis Perelyubskiy | last post by:
Hello, I need to make an array of elements accross forms. My javascript skills, as evident from this question, are rather rudimentary. I tried to make an associative array and index it with...
20
by: K.M. Jr. | last post by:
Hi all, Consider this line - char s = "\0"; Does this initialize all array elements to zero ? Thanks.
12
by: arkobose | last post by:
my earlier post titled: "How to input strings of any lengths into arrays of type: char *array ?" seems to have created a confusion. therefore i paraphrase my problem below. consider the...
11
by: termin | last post by:
consider this char *arr; why doesn't arr=malloc(20); this work ?
6
by: Kannan | last post by:
Hi, I have question about character array initialization. In section 6.7.8 paragraph number 21, it's given that "If there are fewer initializers in a brace-enclosed list than there are...
3
by: mark.bergman | last post by:
Running lint on code initialising a local 2-D array gives a warning. void f(void) { int a = { 0 }; ... lint gives "warning: Partially elided initialisation..." Should this be happening,...
14
by: dan | last post by:
I would like to have the preprocessor automatically generate the number of array elements requested. Each element is zero. The elements get pasted into a larger array. The other elements may be...
4
by: damiensawyer | last post by:
Hi, I've recently moved to c# framework 2 and have just discovered the comiler warning "The result of the expression is always 'false' since a value of type 'int' is never equal to 'null' of...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.