PDA

Click to See Complete Forum and Search --> : Refreshing a form


mfoster
Jun 19th, 2001, 04:38 AM
Hi

When any of my forms load then the data for the controls on the form is
loaded from my data layer dll's ( there are no bound controls).

However, the form takes several seconds to appear and looks untidy due to
the delay. I realise this is because Vb has switched processing to the data
but ideally I would like the form to load first. I can get round it by
putting a timer on the form and delaying the data load but this is messy. Is
there any other way I can do it using redraw methods or the api

Mnay thanks

Mark Foster

MerrionComputin
Jun 19th, 2001, 05:10 AM
I tend to have a public variable which tells you that the form_Load() has completed successfully and only then show the form:

'Form code

Public FormLoaded As Boolean

Private Sub Form_Load()
'Load data stuff....

'inform process that the form has loaded OK
FormLoaded = True
End Sub


Then to load the form cleanly do thus:

Public Sub LoadModalFormCleanly(byval frm As Form)
While Not frm.FormLoaded Do
'\\ Wait for form to have completely loaded
DoEvents
Wend

frm.Show vbModal

End Sub


HTH,
D