Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Rapid switching between instances of a complex composite control in VB.Net and Windows Forms App using VS 2010

$
0
0

I have an almost working Windows Forms app built using VS2010 and VB.Net. The solution includes a class library `ctlOpDatLib` with a class `ctlOpDat` which is a rather complex composite control containing multiple tab controls and datagridviews. When the app runs, a large number of instances of ctlOpDat are created (typically 100 to 200), but only one of them needs to be visible at any one time, and one needs to be able to switch rapidly from one instance to any other. My current solution is to create each ctlOpDat instance in a tab of a tab control. All ctlOpDat instances therefore reside in memory at the same time and consume window handles; this works well until the user attempts to create too many, and we get   'Error creating window handle'   although we don't run out of memory.

Could you suggest a better programming strategy, please? I thought about displaying only one instance of ctlOpDat and accomplishing the rapid switching of contents by loading memory-resident datasets which would be created when the user first asks for them (time consuming process, order of 20 to 60 seconds). But I am at a loss how best to create such datasets: serialization and/or reflection (I have no experience with these, but can learn if advisable); cloning of control (again, I wouldn't know how); just write a bunch of code to copy the datagridview contents to structures and arrays (I suspect that's going to be slow); use the existing way using tab controls and just be more careful about using up too many window handles? What else comes to mind, please?

Thank you!

r4


r4


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>