473,326 Members | 2,438 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,326 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 1738
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...

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.