Binding between a ListBox and an ArrayList

I want to bind a ListBox with an ArrayList. I use this simple code:

dim x as new ArrayList()

x.Add("primo")
x.Add("secondo")
x.Add("terzo")
x.Add("quarto")
x.Add("quinto")

ListBox1.DataSource = x

But, when I change an ArrayList item, or I add or delete an element, I can't see the updates on ListBox. What do I have to do?

Many thanks

Cold

[425 byte] By [codefund.com] at [2007-12-16]
# 1
IList is an interface that represents a list of items. ArrayList is one of these.

IBindingList extends IList and adds change notification: when an item on the list changes, an item is deleted, the list is sorted, etc. an event fires that lets you know what changed.

You'd need to bind to an IBindingList instead. One easy way to do this is to create a DataTable and bind to that:

Dim dt As New DataTable()
dt.Columns.Add("ordinal")

dt.Rows.Add(New Object() {"primo"})
...

ListBox1.DataSource = dt
ListBox1.DisplayMember = "ordinal"

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms Data Controls and Databinding...