Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Screen Update

Status
Not open for further replies.

DarkConsultant

Programmer
Dec 4, 2007
156
GB
Hi,

I am building an app that uses around a hundred dynamic controls across 3 different views. I am currently making the screen invisible, building the view and then making the screen visible which looks iffy.

Is there any way to disable screen updating while I build the screen and re-enable when I have finished? I used to be able to do this under VB6 but I have completely forgotten how to do it and I can no longer read my notes.

TIA
 
Hi Chrissie,

Thanks for your response.

Sample code
Code:
Private Sub BuildControls()

Me.SuspendLayout

<code to build new controls>

(I have swapped these around and it makes no difference)

<code to destroy old controls>

Me.ResumeLayout

End Sub

Yah I thought so too but it doesnt. While the controls are being built inside the Me.Suspend and Me.Resume code the screen shows each control appearing and the old control disappearing as if the Suspend and Resume was not there, it simply made no difference. I have no Application.DoEvents in the code and nothing that would cause a screen update.

Ideally I would like the screen to stay as the old screen while the new controls were being built and then update all at once but this is where I come unstuck.

Any ideas.
 
1) What do you mean by different views?

2) What are you putting the controls on?

3) What kind of controls? Short list this (ie. a few buttons, listview, datagrid, etc).

-I hate Microsoft!
-Forever and always forward.
 
Hi Sorwen,

My database has 3 distict views ie Agents (main db), Leads and Projects. All of the controls for these (TextBoxes, Labels etc are created dynamically when switching to each view so for exampleu a user switches from Agent view to Project view all Agent controls are destroyed and all Project controls created. I cannot stop this being visible so have resorted to reducing the opacity to 0 create new controls and then increasing back to 1 (100%). In VB6 I had an API call to stop screen updates but this does not work any more.

Any ideas?
 
Really, it sounds like the best option would likely be doing a tab pages and having each view on it's own page. Kind of depends on how often they are going back and forth between views. It can become really time consuming and program intensive tp keep creating/destorying that many controls.

If you still want to do it without tabs then my first thought is that instead it might be better to make a new Windows Control Library for each view and then just create/destroy an instace of each view. In general it is doing the same thing, but when you suspend it should create and destory as a group. It see it all as one control so it builds everyting the control needs at once and then you add that one control to the form.

-I hate Microsoft!
-Forever and always forward.
 
Ah, just incase you don't know a Windows Control Library is just a specialized type of class. Mainly it just allows you to visually edit your group of controls rather than coding each control if you were to do it in just a normal class.

-I hate Microsoft!
-Forever and always forward.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top