This question is locked. New answers and comments are not allowed.
I list by business objects in a listbox. It find it extremly slow to load.
Here is my code:
and the output is:
We are only talking about 584 records so it's not a huge amont of data.
Any advice?
Here is my code:
| Dim lngTick As Long = Environment.TickCount |
| lbxPromotionProduct.BeginUpdate() |
| Dim prods As ProductROCollection = ProductROCollection.GetProductsRO(_identity.CompanyId) |
| Debug.WriteLine("Time to Load collection" & vbTab & Environment.TickCount - lngTick) |
| lngTick = Environment.TickCount |
| If prods.Count > 0 Then |
| If optPromotionProductListByName.Checked Then |
| prods.SortStable("productName", System.ComponentModel.ListSortDirection.Ascending) |
| Else |
| prods.SortStable("productRef", System.ComponentModel.ListSortDirection.Ascending) |
| End If |
| End If |
| Debug.WriteLine("Time to SortStable" & vbTab & Environment.TickCount - lngTick) |
| lngTick = Environment.TickCount |
| With lbxPromotionProduct |
| .DataSource = Nothing |
| .DisplayMember = "productRefName" |
| .ValueMember = "productRef" |
| .DataSource = prods |
| Debug.WriteLine("Time to DataSource" & vbTab & Environment.TickCount - lngTick) |
| lngTick = Environment.TickCount |
| If .SelectedIndex > -1 Then .SetSelected(.SelectedIndex, False) |
| Debug.WriteLine("Time to Selected" & vbTab & Environment.TickCount - lngTick) |
| lngTick = Environment.TickCount |
| End With |
| lbxPromotionProduct.EndUpdate() |
| Debug.WriteLine("Time to EndUpdate" & vbTab & Environment.TickCount - lngTick) |
| Time to Load collection 501 |
| Time to SortStable 110 |
| Time to DataSource 6820 |
| Time to Selected 0 |
| Time to EndUpdate 2213 |
We are only talking about 584 records so it's not a huge amont of data.
Any advice?