(Sumber: milist DOTNET) Apakah perlu BindingSource kalau mau menggunakan BindingList untuk ComboBox.DataSource? RRS feed

  • Pertanyaan

  • Rekans,


    Banyak contoh di Internet menggunakan BindingSource sebagai DataSource dari ComboBox control.


    Nah, kalau saya mau sumber datanya dari sebuah BindingList, perlu nggak dibungkus BindingSource dulu?


    Apa sih fitur yang diberikan BindingSource?



    Pengirim: Pandu E Poluan

    Jumat, 06 Mei 2011 03.43


  • Siang Pak Pandu,


    Menggunakan BindingSource tetap disarankan. Berikut yang saya kutip dari MSDN blog:


    Of course you can bind the DataGridView to the DataTable directly and bypass the BindingSource, but BindingSource has certain advantages:

    -  It exposes properties to Sort the list, Filter the list, etc. which would other wise be a pain to do. (i.e. if you bind the DataGridView to the DataTable directly then to Sort the DataTable you need to know that DataTable is an IListSource which knows the underlying list which is a DataView and a DataView can be sorted, filtered, etc.).

    -  If you have to set up master/child views then BindingSource does a great job of doing this

    -  Changes to the DataTable is hidden


    Sumber: BindingSource and BindingList Of T - DataBinding made simple! http://blogs.msdn.com/b/dchandnani/archive/2005/03/12/394438.aspx


    Jika anda lebih ingin mengenal fitur dalam BindingSource bisa dibaca disini:


    #BindingSource - A Closer Look...

    Agnes Sannie [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Jumat, 06 Mei 2011 03.44