I have an arraylist of for example 1200. I want to re organize the
array so that position 1 on the arraylist if actaully now position 3
and i want to add 3 position before position 3 and at the end of the
arraylist. Can i use the Redim statement?

Re: Resizing an arraylist by Armin

Armin
Mon May 05 09:16:40 CDT 2008

"cmdolcet69" <colin_dolcetti@hotmail.com> schrieb
> I have an arraylist of for example 1200. I want to re organize the
> array so that position 1 on the arraylist if actaully now position 3
> and i want to add 3 position before position 3 and at the end of the
> arraylist. Can i use the Redim statement?

The benefit in using an Arraylist is that you do _not_ have to (and
can't) ReDim anything. Use the Add/Insert/Remove/RemoveAt methods to
add/remove items. In VB 2005 and above, there are several additional
Generic lists, like List(Of T).


Armin


Re: Resizing an arraylist by cmdolcet69

cmdolcet69
Mon May 05 09:56:51 CDT 2008

On May 5, 10:16=A0am, "Armin Zingler" <az.nos...@freenet.de> wrote:
> "cmdolcet69" <colin_dolce...@hotmail.com> schrieb
>
> > I have an arraylist of for example 1200. I want to re organize the
> > array so that position 1 on the arraylist if actaully now position 3
> > and i want to add 3 position before position 3 and at the end of the
> > arraylist. Can i use the Redim statement?
>
> The benefit in using an Arraylist is that you do _not_ have to (and
> can't) ReDim anything. Use the Add/Insert/Remove/RemoveAt methods to
> add/remove items. In VB 2005 and above, there are several additional
> Generic lists, like List(Of T).
>
> Armin

How can i add in 3 position at the start???

Re: Resizing an arraylist by Herfried

Herfried
Mon May 05 10:02:15 CDT 2008

"cmdolcet69" <colin_dolcetti@hotmail.com> schrieb:
> > I have an arraylist of for example 1200. I want to re organize the
> > array so that position 1 on the arraylist if actaully now position 3
> > and i want to add 3 position before position 3 and at the end of the
> > arraylist. Can i use the Redim statement?
>
> The benefit in using an Arraylist is that you do _not_ have to (and
> can't) ReDim anything. Use the Add/Insert/Remove/RemoveAt methods to
> add/remove items. In VB 2005 and above, there are several additional
> Generic lists, like List(Of T).
>
>How can i add in 3 position at the start???

Take a look at 'ArrayList.Insert'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Re: Resizing an arraylist by Armin

Armin
Mon May 05 11:10:31 CDT 2008

> "cmdolcet69" <colin_dolcetti@hotmail.com> schrieb
> On May 5, 10:16 am, "Armin Zingler" <az.nos...@freenet.de> wrote:
> > "cmdolcet69" <colin_dolce...@hotmail.com> schrieb
> >
> > > I have an arraylist of for example 1200. I want to re organize
> > > the array so that position 1 on the arraylist if actaully now
> > > position 3 and i want to add 3 position before position 3 and at
> > > the end of the arraylist. Can i use the Redim statement?
> >
> > The benefit in using an Arraylist is that you do _not_ have to
> > (and can't) ReDim anything. Use the Add/Insert/Remove/RemoveAt
> > methods to add/remove items. In VB 2005 and above, there are
> > several additional Generic lists, like List(Of T).
> >
> > Armin
>
> How can i add in 3 position at the start???


Probably you are looking for the Insert method that I have mentioned
before.


Armin


Re: Resizing an arraylist by surturz

surturz
Mon May 05 21:25:00 CDT 2008

I think this is what you are after:

Module Module1
Sub Main()
Dim arl As New ArrayList
'initialise
arl.Add(0)
arl.Add(1)
arl.Add(2)
arl.Add(3)
arl.Add(4)
arl.Add(5)
'move first two elements to the end
arl.Add(arl(0))
arl.RemoveAt(0)
arl.Add(arl(0))
arl.RemoveAt(0)

For Each o As Object In arl
Console.Write(o.ToString & " ")
Next
Console.ReadKey()

End Sub

End Module


--
David Streeter
Synchrotech Software
Sydney Australia