Results 1 to 15 of 15

Thread: wait for me.show to complete

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2005
    Posts
    530

    wait for me.show to complete

    I have a section of code in which I want to display a messagebox after a form is displayed... as the form loads. I used....

    me.show
    messagebox.show

    If I don't use me.show first, the messagebox appears before the form is displayed. If I do use me.show first, the form appears, but is not always complete before the messagebox appears. Is there an easy way to poll the form to see if it is done displaying without using a timer?

    Thanks.

  2. #2
    Frenzied Member
    Join Date
    Aug 2009
    Location
    Los Angeles
    Posts
    1,335

    Re: wait for me.show to complete

    Did you try putting the messagebox in the form shown event?
    also if you have code that runs in the form load event make sure you put the messagebox as the last line of code

  3. #3
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: wait for me.show to complete

    Put the messagebox code in the Shown event instead of the Load event.

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    May 2005
    Posts
    530

    Re: wait for me.show to complete

    Is there such an event in VB.NET 2003?

  5. #5
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: wait for me.show to complete

    I think so. I don't have it with me. 2003 is framework 2.0, right? Or is that 2005?

  6. #6
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: wait for me.show to complete

    Quote Originally Posted by rickford66 View Post
    Is there such an event in VB.NET 2003?
    No. The Form.Shown event wasn't available until .Net 2.0. However, you could use a combination of a boolean variable and Form.Activated event to achieve what you need.
    Code:
    'Class level boolean flag
    Private formshown as Boolean = False
    
    'Then in form.activated event handler, you do
    If Me.formshown = False Then
       Me.formshown = True
       MessageBox.Show("your message here")
    End If
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  7. #7
    Master Of Orion ForumAccount's Avatar
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    2,802

    Re: wait for me.show to complete

    Or upgrade, what possible reason do you have to stay on the obsolete framework?

  8. #8
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: wait for me.show to complete

    Quote Originally Posted by ForumAccount View Post
    Or upgrade, what possible reason do you have to stay on the obsolete framework?
    Good point. Upgrading is easy and you will definitely appreciate the new features.

  9. #9
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: wait for me.show to complete

    Quote Originally Posted by ForumAccount View Post
    Or upgrade, what possible reason do you have to stay on the obsolete framework?
    IT support guys and programmers do not always work with each others in harmony... For example, in a large corporation where my wife works, a simple request to the IT folks such as unblocking a work related website takes 3 months. Now imagine asking them to install .net 2.0 on a few dozen thousands PC's...
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  10. #10
    Master Of Orion ForumAccount's Avatar
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    2,802

    Re: wait for me.show to complete

    Quote Originally Posted by stanav View Post
    IT support guys and programmers do not always work with each others in harmony... For example, in a large corporation where my wife works, a simple request to the IT folks such as unblocking a work related website takes 3 months. Now imagine asking them to install .net 2.0 on a few dozen thousands PC's...
    Better send that request in now!

  11. #11

    Thread Starter
    Fanatic Member
    Join Date
    May 2005
    Posts
    530

    Re: wait for me.show to complete

    I work for a very small_company (~15), so upgrading to the newest framework would be easy in that sense. The reason is that I'm the only EE/Programmer here and I'm a busy guy. I'm not sure if I want to deal with the headache of converting our programs over to the newest rev.... actually, I don't know how much headache it will actually be. Also, some of our apps are running on machines that run W98, so that might also be an issue. I haven't investigated it yet.
    Last edited by rickford66; Jun 28th, 2011 at 08:39 AM.

  12. #12
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: wait for me.show to complete

    The change from 2003 to 2005 is larger than changes between any other two. Still, that is largely due to a lot of new features added in framework 2.0, which would be good to get.

    Fortunately, you don't really have to worry about it. You can have multiple versions of VS installed on the same computer at the same time, and they will all work fine together. Therefore, you could install 2010, make a copy of the 2003 project, try out the copy in 2010 (once you upgrade it can be a real pain to go back, which is why a copy would be a good idea to start with), and decide how difficult the change would actually be.
    My usual boring signature: Nothing

  13. #13
    PowerPoster SJWhiteley's Avatar
    Join Date
    Feb 2009
    Location
    South of the Mason-Dixon Line
    Posts
    2,256

    Re: wait for me.show to complete

    also, if the computers are up-to-date, they may have the required framework(s) installed.
    "Ok, my response to that is pending a Google search" - Bucky Katt.
    "There are two types of people in the world: Those who can extrapolate from incomplete data sets." - Unk.
    "Before you can 'think outside the box' you need to understand where the box is."

  14. #14

    Thread Starter
    Fanatic Member
    Join Date
    May 2005
    Posts
    530

    Re: wait for me.show to complete

    I installed VB.NET 2010 Express and converted the program. It gave me many errors but they are all fixed now. Apparently I'm sloppy with my constant declarations because I had a number of them that had to be cleaned up. A lesson learned. Anyway, I loaded the installer and converted that too, but it doesn't want to work. In the solution explorer, it says "application is not installed". Can VB.NET 2010 Express make executables or do I need to buy a copy?

  15. #15

    Thread Starter
    Fanatic Member
    Join Date
    May 2005
    Posts
    530

    Re: wait for me.show to complete

    Apparently, a separate installer project is not required anymore. Checking into this one-click publish thing.

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