#1 (permalink)  
Old 05-18-04, 05:02 PM
Greigorama Greigorama is offline
New Member
 
Join Date: May 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Arrays

Hi there,

I would like to know how i can write an array where data coming into the array gets put in index 0 while the rest of the data in the array moves up an index place.

Any help anyone can offer would be much appreciated.
Reply With Quote
  #2 (permalink)  
Old 05-21-04, 01:02 AM
EvilHaider EvilHaider is offline
Newbie Coder
 
Join Date: Apr 2004
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Hmm...I'm not sure why you would want to do such a thing. Performance wise, this would not be a good idea. Why exactly do you need to make the new item index 0? To move the rest of the data in the array by one index place you'd have to shift each element in the array. If the array is large that's a lot of shifts. Is it absolutely necessary for you to do this?
__________________
**
Tutorial Maniacs
**
Reply With Quote
  #3 (permalink)  
Old 06-16-04, 12:33 AM
Alison Forezli Alison Forezli is offline
Newbie Coder
 
Join Date: Jun 2004
Location: Calgary, Alberta, Canada
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Greigorama
Hi there,

I would like to know how i can write an array where data coming into the array gets put in index 0 while the rest of the data in the array moves up an index place.

Any help anyone can offer would be much appreciated.

IF YOU CAN PROGRAM IN JAVA, USE A VECTOR. IT HAS BUILT-IN CAPABILITY OF AUTOMATICALLY SHIFTING CONTENTS WHEN YOU INSERT AT A SPECIFIC
INDEX. OTHERWISE, YOU WILL BE GOING THROUGH MANY LOOPS IF YOU USE VB.NET.
Reply With Quote
  #4 (permalink)  
Old 06-17-04, 05:13 AM
alextyx alextyx is offline
New Member
 
Join Date: Jun 2004
Location: Prato - Tuscany - Italy
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Perhaps you need to have a look at ARRAYLIST class:


Code:
 

PrivateSub ProvaArray()

Dim Arr AsNew ArrayList

Dim i AsInteger = 0

DoWhile i < 5

Arr.Insert(0, Arr.Count.ToString) 

i += 1

Loop



i = 0

DoWhile i < 5

Debug.WriteLine(CStr(Arr(i)))

i += 1

Loop

EndSub
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Associative Arrays fxsinus JavaScript 4 03-12-04 09:38 AM
Database queries or arrays ? danux PHP 2 03-11-04 07:57 AM
arrays that dont seem to fill up trigger_ph JavaScript 2 11-21-03 06:29 PM
Javascript vs PHP, problem with arrays Chuff JavaScript 0 10-03-03 04:01 AM
Manipulating arrays for display in HTML madsurfer007 PHP 3 08-07-03 08:26 PM


All times are GMT -5. The time now is 02:21 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.