3
Contributors
2
Replies
12
Views
4 Years
Discussion Span
Last Post by Anthony21
-1

From MSDN: Bind your DataGridView control to a BindingSource component and bind the BindingSource component further to your data source (IList or IBindingList). Code snippet:

Public Partial Class Form1
    Inherits Form
    Private personsList As New List(Of Person)()
    Private bindingSource As New BindingSource()

    Public Sub New()
        InitializeComponent()
        personsList.Add(New Person("Jacob", "Male", 25))
        personsList.Add(New Person("Peter", "Male", 25))
    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs)
        dataGridView1.DataSource = bindingSource
        bindingSource.DataSource = personsList
    End Sub
End Class

For more information, check out: http://social.msdn.microsoft.com/Forums/en-US/793846c6-cc10-446a-bca1-968b047bb134/bind-datagridview-to-custom-collection

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.