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
135
Grid.Rows.Count = 46, Datasource.Count = 46, Rows not showing in UI
posted

Hello,

I have a UltraWinGrid and a BindingSource object.  During run time I create a list of my Facility class and bind the BindingSource to the list.  Then I bind the UltraWinGrid to the BindingSource.

 

    Private Sub SelectAllButton_Click(sender As System.Object, e As System.EventArgs) Handles SelectAllButton.Click
        If FacilityBrowse.ReturnControl.GetType Is GetType(UltraGrid) Then
            Dim fac as frmFacilities = frmFacilities
            Dim list As New List(Of ISMSLib.Facility)
                For Each row As UltraGridRow In ResultsGrid.Rows
                    list.Add(New ISMSLib.Facility With {.ID = row.Cells(0).Value, .Abbreviation = row.Cells(1).Value, .FCL = row.Cells(2).Value})
                Next
            End With
            fac.FacilityBindingSource.DataSource = list
        End If
        Me.Close()
    End Sub

Here is after I leave that method:

 

        ctrFacBrowse.ShowDialog()

        If FacilityBindingSource.Count > 0 Then

            RecordsGrid.DataSource = FacilityBindingSource

            RecordsGrid.Text = "Facilities (" & RecordsGrid.Rows.Count & " Records)"

        End If

 

When I leave this method and go back to frmFacilities, the count for both the DataSource and Grid.Rows is 46.  But nothing shows.  Nowhere else am I "over riding" the datasource...in fact when I go back to "browse" again...the immediate window stills says I have 46 rows in the grid.

Also the default Grid.Text (Header Text) is "Facilities (0 Records)" and after the records are bound in memory the text is updated to "Facilities (46 Records" but that does not "update" on the gird either...just in memory in the immediate window everything (header text, row count) shows correct.

Just not displaying.

EDIT:

RecordsGrid_InitializeRow(sender As Object, e As Infragistics.Win.UltraWinGrid.InitializeRowEventArgs) Handles RecordsGrid.InitializeRow

Is firing 46 times....so I know the rows are being added...

Edit 2:

Added .BeginUpdate and .EndUpdate around setting the grid datasource, then perform a .Refresh, still does not "paint" the grid.

Any ideas?  Thank you for your help.