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.
Hello John,
In order to see the girds columns and data you need to implement get and set methods for your GuestInquiry class. By simply placing the lines below into it you will be able to see the data from the binding list in your grid.
Public Property Id As Integer
Public Property Company As String
Public Property Name As String
Public Property Age As Integer
I am attaching a sample application that demonstrates the changes stated above. Please observe it and let me know if you have any questions.
Regards, Ivan Kitanov
GenericList.zip
Thank you Ivan. That worked. Hopefully Infragistics can update their documentation to make that explicitly clear.
I’m glad that you managed to resolve your issue and thank you for the feedback regarding the documentation.
Thank you for using Infragistics!
Regards,Ivan Kitanov