sharing data

Howdy,

i want to have 2 or more ComboBox's sharing the same pool of data. ie i dont want to have to retype the whole lot 4 or five times, the data will contains peoples names. I have played around a little by having a MS Access Table with a list of names, but this seems inefficient. I also want to be able to ADD more names to this list by pressing a "button" etc.

Any help would be appreciated.

Dwayne

[410 byte] By [Emerg] at [2008-2-4]
# 1
You can just append items to array list and bind both comboboxes to the same array list. If your bindings are a bit more complicated than a string, you can always bind to pretty much any data source.
TobinTitus at 2007-9-8 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 2
Thank you for the answer,

I am a newbie, so my next question, is How do i make this array list?

Dwayne

Emerg at 2007-9-8 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 3

Here's an example form that uses an array list.


Imports System.Collections

Public Class Form1

Dim arr As New ArrayList()

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

arr.Add("Name One")

arr.Add("Name Two")

arr.Add("Name Three")

Me.ComboBox1.DataSource = arr

Me.ComboBox2.DataSource = arr

End Sub

End Class


TobinTitus at 2007-9-8 > top of Msdn Tech,Visual Basic,Visual Basic Language...