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

Am I likely to cause an error?

Hi all,

I have some code which compares values in a recordset to that in an array.

If it finds a match it needs to remove the item from the array.

My concern is that my method for removing the item from the array is by
iterating through it, if it doesn't match then I place the value into a
"temporary" array, after all comparisions are completed I then set the
original array to equal the temporary array.

Am I likely to generate an error if my internal looping of the same array
changes the array size, whilst still iterating through it..

eg..

For x = 0 to ....

if comparision is true then

for y = 0 to ....

if comparision is false then

' add value to temporary array here

end if

next

array = temporary array

end if

Next

My feeling is that this will go mammories up...

Regards

Rob
Jul 10 '06 #1
2 1012
CJM

"Rob Meade" <ku***************@edaem.borwrote in message
news:eb**************@TK2MSFTNGP04.phx.gbl...
>
Am I likely to generate an error
Hopefully.. it's what development is all about...!
if my internal looping of the same array changes the array size, whilst
still iterating through it..
OIC. Yes definitely. At least I think so, give the little that you have told
us.

If you are intent on looping through your initial array, and you mean to
selectively remove items from it, whilst continually updating it, then yes
you will invoke an error... At some point your original array will shrink
and your loop will try to query an item that no longers exists - when x = a
value greater than the UBound of your modified array.
>
My feeling is that this will go mammories up...
Same here.

More importantly, I dont think your overall approach is right, but it's
difficult to tell without a bit more context. What are actually trying to
achieve?

Regardless, I wouldnt recommend modify your initial array until you have
completely looped through it.

CJM
Jul 10 '06 #2
"CJM" wrote ...
Same here.
Cheers for the confirmation...
More importantly, I dont think your overall approach is right, but it's
difficult to tell without a bit more context. What are actually trying to
achieve?
It's a rather long winded explanation so I'll not trouble you with it - as I
think I'm about there now, but just needed to check this as I guessed a
different approach would be needed..

Thanks :o)

Rob
Jul 10 '06 #3

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

Similar topics

3
by: dan baker | last post by:
I have a couple page where even after they are done loading, the status message gets stuck with "Transferring data from <host>... Are there some typical syntax errors in either javascript of html...
3
by: harry | last post by:
Hi This error appears from time to time either when my VB.NET program starts or at some time during runtime. It is absolutely inconsistent. I change nothing in my code and yet after I restart...
59
by: kk_oop | last post by:
Hi. I wanted to use exceptions to handle error conditions in my code. I think doing that is useful, as it helps to separate "go" paths from error paths. However, a coding guideline has been...
3
by: Fred Nelson | last post by:
I'm devloping a Web Application in VB.NET. In my web.config file I have specified that untrapped errors are to be sent to the page "errorpage.aspx". This is working fine - if an untrapped error...
1
by: daniel | last post by:
I'm devloping a Web Application in VB.NET. In my web.config file I have specified that untrapped errors are to be sent to the page "errorpage.aspx". This is working fine - if an untrapped error...
7
by: dotnetprogrammer via DotNetMonster.com | last post by:
I have an NT Service written in c# (.net framwork 2.0). When it hits a certain error condition, I want it to be to cause itself to stop. How can I do this? -- Message posted via...
16
by: Jim Langston | last post by:
I know that functions starting with an underscore, or two underscores, are reserved by the compiler/c++ and should not be used by the user and may cause undefined behavior. My question is, how...
6
by: wij | last post by:
Hi: I made a simple code(t.cpp) like below #include <iostream> int main() { std::cout << "helo! world.\n"; return(0); };
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
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...
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
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...

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.