Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
265
Problem using List(of T) and BindingList
posted

I am using version 18.1 in Visual Studio 2019.  I created a brand new Visual Basic WinForms project using .Net Framework 4.7.2.  I have to use Visual Basic due to an existing project I am working on.  This is just a test to try and get it working.

I have the following code to populate an UltraGrid with some data in a BindingList.  However, when I do, I only see the row selectors and nothing else.  I did not do anything with the grid designer.  Simply added the grid to the form and that is it.

Imports System.ComponentModel

Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        Dim listGuests As BindingList(Of GuestInquiry) = New BindingList(Of GuestInquiry)
        Dim g1 As New GuestInquiry With {.Id = 1, .Company = "HA", .Name = "Jason", .Age = 45}
        Dim g2 As New GuestInquiry With {.Id = 2, .Company = "PC", .Name = "John", .Age = 54}
        listGuests.Add(g1)
        listGuests.Add(g2)

        gridTest.DataSource = listGuests
    End Sub
End Class

Public Class GuestInquiry
    Public Id As Integer
    Public Company As String
    Public Name As String
    Public Age As Integer
End Class

This is what is displayed:

I have also using just a List(Of GuestInquiry) instead of a BindingList, but that doesn't work either.  What am I doing wrong?  This link seems to indicate that my code is right, but neither the data nor column headers are showing.  https://www.infragistics.com/help/winforms/wingrid-generic-lists

Thank you.

Parents Reply Children
No Data