Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

delete a range of values from array and resize

Posted on 2007-03-22
3
Medium Priority
?
156 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:Winston Smith
[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:Winston Smith
ID: 18774364
Worked like a charm!!

Thanks!
0
 
LVL 23

Expert Comment

by:Christopher Kile
ID: 18774488
yvw :)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

604 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