how to bind a datagridview to a list of custom classes??
pls i need your help guys, tnx.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.