Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
When I set the list to NEW, I get 'O' data. Currently getting no data.

VB
Private Sub ContctDomainDataSource_LoadedData(ByVal sender As System.Object, ByVal e As System.Windows.Controls.LoadedDataEventArgs) Handles ContctDomainDataSource.LoadedData
        ActivityDisplay.IsActive = False

        Dim _lst As List(Of Contct)()
        ContctDataGrid.ItemsSource = _lst
        Dim iRowCount As Integer = _lst.Count()

        CountBox1.Text = _lst.Count

        If e.HasError Then
            System.Windows.MessageBox.Show(e.Error.ToString, "Load Error", System.Windows.MessageBoxButton.OK)
            e.MarkErrorAsHandled()
        End If
    End Sub

I found a post that shows that item count has been incorporated in the Domain Service. But I still haven't resolved displaying the count in a textbox.

Dim loadCustomer As EntityQuery(Of Customer_Profile2) = Domaincontext.GetCustomerProfileQuery() loadCustomer.IncludeTotalCount = True
Dim loadOp = Domaincontext.Load(Of Customer_Profile2)(loadCustomer).TotalEntityCount


http://blogs.msdn.com/b/deepm/archive/2010/03/18/count-t.aspx?CommentPosted=true#commentmessage
Posted
Updated 8-Nov-10 1:20am
v4

Looks like you are creating an empty list, then setting the items source on the grid to that empty list. Though, wouldn't you usually use the "new" keyword when creating an empty list? And why would you expect the count of an empty list to be anything but zero?
 
Share this answer
 
Simply display the count of the datagrid's underlying collection - that should be what you are looking for.
 
Share this answer
 
<pre lang="vb">If (DataGrid.ItemsSource IsNot Nothing) Then
            Dim count As Integer = DataGrid.ItemsSource.OfType(Of Object)().Count()
            lblCount_Gen.Content = "Count: " & count
        End If

 
Share this answer
 
I think you should cast the type of _lst.Count() to String.. :-D
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900