Results 1 to 2 of 2

Thread: Refreshing a form

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2000
    Posts
    25

    Refreshing a form

    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

  2. #2
    Frenzied Member MerrionComputin's Avatar
    Join Date
    Apr 2001
    Location
    Dublin, Ireland
    Posts
    1,616
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width