473,624 Members | 2,191 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.IndexOu tOfRangeExcepti on' , 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 1767
With Deft Fingers, "Gary" <sp**@spam.ne t> 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.IndexO utOfRangeExcept ion' , 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.ne t> 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.IndexO utOfRangeExcept ion' , 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.ne t> 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.IndexOu tOfRangeExcepti on' , 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.ne t> 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.IndexOu tOfRangeExcepti on' , 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.ne t> 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.IndexOu tOfRangeExcepti on' , 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.ne t> 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.IndexOu tOfRangeExcepti on' , 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.ne t> 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.IndexOu tOfRangeExcepti on' , 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.ne t> 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.IndexOu tOfRangeExcepti on' , 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
9663
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
328
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, 'System.IndexOutOfRangeException' , does this mean I have to somewhere reset/clear my array before I can re-execute my program?.
28
16604
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
5427
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 of client objects called aClients if I try aClients.RemoveAt I get an error "System.Array" does not contain a definition for "RemoveAt".
65
4187
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 difference is between these and: (3) mylist =
13
2851
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
1843
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 typically just standardize on the most compact form?
16
1652
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 test I have attempted to send a valid address, then an invalid address which my ISP (Comcast) will reject immediately as "Not our customer". I catch the exception, display and then continue looping to send several additional valid. The balance...
3
1767
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 should it be altered? typedef unsigned char Byte; #define MAX_ACTIONS 10 /* ... */
4
1514
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 = File.ReadAllLines(Application.StartupPath & "\login\details\" & Login.CboServicePerson.Text & ".pas") ' & (STR(1) & CboText & ".pas")) Form1.txtUser.Text = STR(1) 'textline Form1.txtPosition.Text = STR(2) Form1.txtDepartment.Text = STR(3)
0
8234
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8172
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8620
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8335
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8474
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7158
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4079
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1482
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.