Cache panels

  • Thread starter Thread starter A. Haeser
  • Start date Start date
A

A. Haeser

Hello,

I have build a little application with dynamic usercontrols on a panel.
Sometimes there are 5 userscontrols on the panel, sometimes much more.
It is database driven, everey usercontrol needs to get details from
database.

I've tried to cache some panels in a collection using a key. This gives
me more performance because about of 25 keys will be used randomely.

Here a little indication of the code:

dim col as new collection 'my panels - cache
'On the form I've the mainpanel:
protected withevents mainpanel as new System.windows.forms.panel

private sub createPanel(byval key as string)

dim panel1 as new System.windows.forms.panel

try
mainpanel = col.item("thekey")
return 'yes, success from cache!
catch
'no item in cache
end try

... 'add controls to panel1
... 'add more controls to panel1

'Add this item to cache
col.add("thekey", panel1)

mainpanel = panel1
end sub

-----------------------------------------------------------
Question / problem itself:
Why doesn't this work, when showing a cached panel I see no controls
on the panel! The controls had a reference to nothing? How can I solve
this?

(I've tried to do the same with caching a array of all controls on the
panel, that works fine)
 
A,

Are you familiar with the debug possibilities in Visual Studio Net?

Cor
 
Yes, I'm familiar with it.And did you try it, because the error should be somewhere in your code, now
you show the begin and the end but how can we see where the error is?

Cor
 
There is no error, but the panel, loaded from cache will not have /
show the dynamic added controls!



A. Haeser schreef:
 
Back
Top