?
Solved

delete a range of values from array and resize

Posted on 2007-03-22
3
Medium Priority
?
155 Views
Last Modified: 2010-04-23
I have a byte array that holds 100 values, i search through and find 20 values that i copy to a new array, then i need to delete the values from the original array and resize it.
Here is what i have so far.

'byte array to hold the chunk
                Dim bytChunk As Byte()
                'make it the needed size
                ReDim bytChunk(shrtTailIndex - shrtHeadIndex)
                'copy the bytes from the ring buffer to the chunkbuffer
                Array.Copy(bytRingBuffer, shrtHeadIndex, bytChunk, 0, bytRingBuffer.Length)


What i need to know is how to delete the array of values and then resize it so there is no blank space inside if that would be the case

VB.NET VS2005

Thanks!!
0
Comment
Question by:Halon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 23

Accepted Solution

by:
Christopher Kile earned 2000 total points
ID: 18774294
Add these lines:

Array.Copy(bytRingBuffer, shrtTailIndex + 1, bytRingBuffer, shrtHeadIndex, bytRingBuffer.Length - (shrtTailIndex + 1))
Redim Preserve byt((bytRingBuffer.Length - 1) - (shrtTailIndex - shrtHeadIndex + 1))

I tested this using { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } with shrtHeadIndex = 3 and shrtTailIndex = 6 and got { 0, 1, 2, 7, 8, 9 }
0
 

Author Comment

by:Halon
ID: 18774364
Worked like a charm!!

Thanks!
0
 
LVL 23

Expert Comment

by:Christopher Kile
ID: 18774488
yvw :)
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month13 days, 14 hours left to enroll

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question