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.
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
Re: wait for me.show to complete
Put the messagebox code in the Shown event instead of the Load event.
Re: wait for me.show to complete
Is there such an event in VB.NET 2003?
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?
Re: wait for me.show to complete
Quote:
Originally Posted by
rickford66
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
Re: wait for me.show to complete
Or upgrade, what possible reason do you have to stay on the obsolete framework?
Re: wait for me.show to complete
Quote:
Originally Posted by
ForumAccount
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.
Re: wait for me.show to complete
Quote:
Originally Posted by
ForumAccount
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...
Re: wait for me.show to complete
Quote:
Originally Posted by
stanav
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! :D
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.
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.
Re: wait for me.show to complete
also, if the computers are up-to-date, they may have the required framework(s) installed.
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?
Re: wait for me.show to complete
Apparently, a separate installer project is not required anymore. Checking into this one-click publish thing.