2nd form is not visible directly after loading


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: 2nd form is not visible directly after loading

  1. #1
    Erik Bartmann Guest

    2nd form is not visible directly after loading


    Hi there,

    I wrote a program which opens a 2nd form on pressing a button. (Nothing special:-))
    On this 2nd form there is a listview and its filled with severel data line
    by line and it takes some seconds. My problem is now that this 2nd form
    is not visible until the listview is filled up with all the data. I want
    it visible at beginning of loading this form.
    I tried to use the 'application.doevents()' statement after definding the
    listview, so that it is displayed after that... But it doesn't work!

    Has anyone an idea how to make this form driectly visible after loading?

    Best regards

    > Erik


  2. #2
    Jason Guest

    Re: 2nd form is not visible directly after loading


    I'm no expert on this, but it could be that you are loading the data in the
    Load event, and the form won't actually become visible until after the Load
    event has completed. There is nothing you can do about this behavior. It
    is the way the thing is designed. In VB6, there was an Activate event, and
    it fired after the form painted the first time. There was also the paint
    event (you could load on the first one, then ignore any further paint events).

    I haven't looked at this in VB.NET, but I'd be surprised if you could not
    solve your problem pretty simply by just using a different event.

    "Erik Bartmann" <message@shadowworker.de> wrote:
    >
    >Hi there,
    >
    >I wrote a program which opens a 2nd form on pressing a button. (Nothing

    special:-))
    >On this 2nd form there is a listview and its filled with severel data line
    >by line and it takes some seconds. My problem is now that this 2nd form


    >is not visible until the listview is filled up with all the data. I want
    >it visible at beginning of loading this form.
    >I tried to use the 'application.doevents()' statement after definding the
    >listview, so that it is displayed after that... But it doesn't work!
    >
    >Has anyone an idea how to make this form driectly visible after loading?
    >
    >Best regards
    >
    >> Erik



  3. #3
    Paul Mc Guest

    Re: 2nd form is not visible directly after loading


    G'day

    >but I'd be surprised if you could not
    >solve your problem pretty simply by just using a different event.


    If the poulation of the list box is taking a while, you could also populate
    it via an async method:

    ie
    Put list box population into a sub on the form, with the following signature


    Private Sub PopulateList(State as Object)

    In Sub New, put the following:
    System.Threading.ThreadPool.QueueUserWorkItem(AddressOf PopulateList)

    Cheers,
    Paul





Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center