title: How to bind a DataGridView to a list of custom classes
body: <p>I have a list of custom classes that I am building using a <code>TableAdapter</code>.</p>
  
  <p>I want to add these to a <code>DataGridView</code> binding certain columns only.</p>
  
  <p>I have tried the code below to fill and bind the data:</p>
  
  <pre><code>lAllBookings = (From r As DataRow In BookingsTableAdapter1.GetDataWithItems().Rows
                          Select New Booking With {.bookingID = r.Item("BookingID"), _
                                                   .itemID = r.Item("ItemID"), _
                                                   .bookedOutDate = r.Field(Of DateTime?)("BookedOutDate"), _
                                                   .bookedInDate = r.Field(Of DateTime?)("BookedInDate"), _
                                                   .identType = r.Item("IdentType"), _
                                                   .identString = r.Item("IdentString"), _
                                                   .image = r.Item("Image"), _
                                                   .complete = r.Item("Complete"), _
                                                   .notes = r.Item("Notes"), _
                                                   .itemName = r.Item("ItemName"), _
                                                   .itemBC = r.Item("ItemBarcode")}).ToList
  
  
  
          dgvBookings.Columns("BookingID").DataPropertyName = "bookingID"
          dgvBookings.Columns("ItemIdent").DataPropertyName = "itemName"
          dgvBookings.Columns("BookedOut").DataPropertyName = "bookedOutDate"
          dgvBookings.Columns("IdentString").DataPropertyName = "identString"
  
  
          dgvBookings.DataSource = lAllBookings
  </code></pre>
  
  <p>Now when I do this I get the correct number of rows but all fields are blank.</p>
  
  <p>I've run through a few questions on SO and a few tutorials but they all seem to do things slightly different to what I need.</p>
  
  <p>Is there a way I can fill the <code>DataGridView</code> using my list of items?
  I'd rather avoid using a <code>DataSet</code> if I can as I've built a lot of other code on this <code>List&lt;Of  Class&gt;</code> type.</p>
  
  <p>Edit - Here is the Class <code>Booking</code> declaration:</p>
  
  <pre><code>Public Class Booking
  
      Public bookingID As Integer
      Public itemID As Integer
      Public itemName As String
      Public itemBC As String
  
      Public identType As Short
      Public identString As String
      Public image As Byte()
      Public complete As Boolean
      Public notes As String
  
      Public bookedInDate As DateTime?
      Public bookedOutDate As DateTime?
  
  End Class
  </code></pre>