Create a custom class, and define a collection for it i.e. BindingList(Of CustomClass). Initialize this and keep it in a vb.net module
On a form, lets call it Form1, put a Grid on it and in Form Load set the datasource to the CustomCollection in the module. On Form 1 also put a button, onclick on which Form2 is opened
Create another form, Form2, there also put a Grid and in Form Load set the datasource to the same Custom Collection in the module.
Now open Form1:
click on the button - this will open Form2, in the load of which grid.datasource = customcollection gets executed. Then close Form2 without doing anything else on it. Repeat this step a few times. You will notice that after each button click the time taken to open Form2, keeps increasing progressively.
I have tested the same on a WIndows DataGrid, it works fine. Repeated clicks on the button in Form1, opens up Form2 right away without any delay
Can you suggest what might be going on
There are too many unknowns here for me to properly test this. Can you provide a small sample project demonstrating this behavior? You can just attach your sample here and I will take a look.
Also, please make sure you have the latest service release. This may be an issue that is already fixed.
The Problem:
If I have a common data-source kept in a vb.net module, which is shared between grids on different forms, things start slowing down. If the forms are closed and re-opened then too things don’t get any better, they start getting worse. The only option is to restart the application. It looks like a memory leak.
Steps to Replicate:
This being a sample app, the classes used as the datasource have been kept relatively simple. In our real world app, the form opening slows down considerably by the 4th time itself. This has made sharing common data between grids on different Forms unusable.
This sample has used Infra Suite 2007 Vol 3. I tried this sample out using Infra Forms Suit 2009 Trial Edition also, but got similar results again.
VS.NET Project
I have a vs.net solution with a Module, 3 forms and some classes
The module has a custom collection with 1000 objects
The forms are as follows:
1. FrmMain – has 2 buttons which opens FrmWindows and FrmInfragistics respectively
2. FrmWindows – has a windows data grid bound to the same datasource in Module 1. Grid IS NOT hierarchical
3. FrmInfragistics – has a Infra grid bound to the same datasource in Module 1. Grid IS hierarchical
Run the solution, and
Here is a comparison for 10 clicks
Time in Seconds
FrmMain
Windows
Infra
1
2
3
4
5
8
6
13
7
19
28
9
39
10
53
Regards
Hemesh