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

Clearing an Array...

Hi

How does one clear an Array?

Situation is when I am executing my program everything works fine, but when
I try and repeat the program without resetting my program I get this error,
'System.IndexOutOfRangeException' , does this mean I have to somewhere
reset/clear my array before I can re-execute my program?.
thanks,

Gary
Nov 22 '05 #1
8 1741
With Deft Fingers, "Gary" <sp**@spam.net> wrote:
How does one clear an Array?
You can do so by a ReDim:

ReDim Preserve ProjArray(12, 0)

or a simple "erase"

Erase ProjArray
I try and repeat the program without resetting my program I get this error,
'System.IndexOutOfRangeException' , does this mean I have to somewhere
reset/clear my array before I can re-execute my program?.


This is probably because you tried to change the size of the Array?

Thus if ProjArray(12, 0) tries to add ProjArray(13, 0), you'll get an error,
unless you ReDim it to ProjArray(13, 0)

Regards,

Bruce
Nov 22 '05 #2
With Deft Fingers, "Gary" <sp**@spam.net> wrote:
How does one clear an Array?
You can do so by a ReDim:

ReDim Preserve ProjArray(12, 0)

or a simple "erase"

Erase ProjArray
I try and repeat the program without resetting my program I get this error,
'System.IndexOutOfRangeException' , does this mean I have to somewhere
reset/clear my array before I can re-execute my program?.


This is probably because you tried to change the size of the Array?

Thus if ProjArray(12, 0) tries to add ProjArray(13, 0), you'll get an error,
unless you ReDim it to ProjArray(13, 0)

Regards,

Bruce
Nov 22 '05 #3
It is clear that you're trying to index past the bounds of the array...but
the only way to find out why is to see some code. Can you elaborate on what
you're doing with the array when this happens or post a code snippet?

ShaneB

"Gary" <sp**@spam.net> wrote in message
news:mG******************@news-server.bigpond.net.au...
Hi

How does one clear an Array?

Situation is when I am executing my program everything works fine, but
when I try and repeat the program without resetting my program I get this
error, 'System.IndexOutOfRangeException' , does this mean I have to
somewhere reset/clear my array before I can re-execute my program?.
thanks,

Gary

Nov 22 '05 #4
It is clear that you're trying to index past the bounds of the array...but
the only way to find out why is to see some code. Can you elaborate on what
you're doing with the array when this happens or post a code snippet?

ShaneB

"Gary" <sp**@spam.net> wrote in message
news:mG******************@news-server.bigpond.net.au...
Hi

How does one clear an Array?

Situation is when I am executing my program everything works fine, but
when I try and repeat the program without resetting my program I get this
error, 'System.IndexOutOfRangeException' , does this mean I have to
somewhere reset/clear my array before I can re-execute my program?.
thanks,

Gary

Nov 22 '05 #5
thanks guys for replying so quick to my message.

yes that was my next step to post the code, but as it turns out I sorted it
out for myself and I was trying to pass the bounds of the index! so at the
end of the event all I had to do was to reset the index, x = 1

Thanks again

Gary
"Gary" <sp**@spam.net> wrote in message
news:mG******************@news-server.bigpond.net.au...
Hi

How does one clear an Array?

Situation is when I am executing my program everything works fine, but
when I try and repeat the program without resetting my program I get this
error, 'System.IndexOutOfRangeException' , does this mean I have to
somewhere reset/clear my array before I can re-execute my program?.
thanks,

Gary

Nov 22 '05 #6
thanks guys for replying so quick to my message.

yes that was my next step to post the code, but as it turns out I sorted it
out for myself and I was trying to pass the bounds of the index! so at the
end of the event all I had to do was to reset the index, x = 1

Thanks again

Gary
"Gary" <sp**@spam.net> wrote in message
news:mG******************@news-server.bigpond.net.au...
Hi

How does one clear an Array?

Situation is when I am executing my program everything works fine, but
when I try and repeat the program without resetting my program I get this
error, 'System.IndexOutOfRangeException' , does this mean I have to
somewhere reset/clear my array before I can re-execute my program?.
thanks,

Gary

Nov 22 '05 #7
oops make that x = 0

"Gary" <sp**@spam.net> wrote in message
news:mG******************@news-server.bigpond.net.au...
Hi

How does one clear an Array?

Situation is when I am executing my program everything works fine, but
when I try and repeat the program without resetting my program I get this
error, 'System.IndexOutOfRangeException' , does this mean I have to
somewhere reset/clear my array before I can re-execute my program?.
thanks,

Gary

Nov 22 '05 #8
oops make that x = 0

"Gary" <sp**@spam.net> wrote in message
news:mG******************@news-server.bigpond.net.au...
Hi

How does one clear an Array?

Situation is when I am executing my program everything works fine, but
when I try and repeat the program without resetting my program I get this
error, 'System.IndexOutOfRangeException' , does this mean I have to
somewhere reset/clear my array before I can re-execute my program?.
thanks,

Gary

Nov 22 '05 #9

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

Similar topics

3
by: Miki Tebeka | last post by:
Hello All, I'd like to bind <CTRL+L> so that it will clear IDLE's screen (in the interactive prompt). Any pointers/suggetions? Thanks. Miki
4
by: Gary | last post by:
Hi How does one clear an Array? Situation is when I am executing my program everything works fine, but when I try and repeat the program without resetting my program I get this error,...
28
by: Terry Andersen | last post by:
I have an array that I initialize to zero, like: Buffer = {0x00}; How do I in my code reset this array to all zeros ones more? Without running a whole for loop? Best Regards Terry
10
by: Liz - Newbie | last post by:
Does anyone know how to clear arrays? My C# books talk about creating arrays or talk about using Clear or RemoveAt but these methods don't appear to be available for my array. I have an array...
65
by: Steven Watanabe | last post by:
I know that the standard idioms for clearing a list are: (1) mylist = (2) del mylist I guess I'm not in the "slicing frame of mind", as someone put it, but can someone explain what the...
13
by: Adam Honek | last post by:
Instead of the ZeroMemory API what would one use in VB.NET to clean an array using a custom structure? The .clear isn't a member of it by default. Any suggestions? Thanks, Adam
4
by: timothytoe | last post by:
I can think of several easy ways to clear out an array. The most obvious: arr=; arr.length=0; arr=null; What do most JavaScript programmers expect to see? Since JS is transmitted, do I...
16
by: Ed Bitzer | last post by:
Trying to send groups of email with program using System.Net.Mail. I do not clear MailMessage but repeatedly loop changing only the Bcc entries. Works fine if all addresses are valid. As a simple...
3
by: Martin | last post by:
Is clearing a structure the following way well defined in C89? The structure ACTION contains no floating point or pointer members. Only integral types. My thoughts concern the padding - can and...
4
by: gobblegob | last post by:
I am trying to clear the array STR but it does not clear it. This sub is in a module. Dim STR As Array 'Dim str(6) As String STR =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.