|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Cache panelsI 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 Show quoteHide quote "A. Haeser" <a*@ttt.nl> schreef in bericht news:1154933335.104567.283060@m79g2000cwm.googlegroups.com... > 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) > Yes, I'm familiar with it.
Cor Ligthert [MVP] schreef: Show quoteHide quote > A, > > Are you familiar with the debug possibilities in Visual Studio Net? > > Cor > > "A. Haeser" <a*@ttt.nl> schreef in bericht > news:1154933335.104567.283060@m79g2000cwm.googlegroups.com... > > 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) > > > 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 Show quoteHide quote > Cor Ligthert [MVP] schreef: > >> A, >> >> Are you familiar with the debug possibilities in Visual Studio Net? >> >> Cor >> >> "A. Haeser" <a*@ttt.nl> schreef in bericht >> news:1154933335.104567.283060@m79g2000cwm.googlegroups.com... >> > 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) >> > > There is no error, but the panel, loaded from cache will not have /
show the dynamic added controls! A. Haeser schreef: Show quoteHide quote > 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)
Update problem ADO vbnet 2005
Altering function of keypress for listbox Getting database fields (rows) to appear as columns in datagrid Convert DAO from VB6 to VB8? Showing a form from within a thread Hyperlink and Label Update a structure when another structure changes Wildcards Route planning Databinding datagridview to textbox |
|||||||||||||||||||||||