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


Answer this question

sharing data

  • lhoward

    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.


  • creatorx2000

    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


     



  • jcstb

    Thank you for the answer,

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

    Dwayne

  • sharing data