473,395 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Showing Msgbox after Form_Load

Something very simple that I can't spot how to do:

I wand to display a msgbox showing some current configuration
parameters when my VB2005 program starts up. However, I want the main
form to paint before the msgbox appears so that the main form appears
as the background to the msgbox. At present I just have the msgbox as
the last item in the Form.Load procedure but not surprisingly it's
appearing on its own and out of context before the main form is
visible.

Is there any event-dependent way of doing this other than using timers
of one sort or another?
May 30 '07 #1
5 4197
John,

You might try placing Me.Show() before the message box command.

Kerry Moorman
"John Dann" wrote:
Something very simple that I can't spot how to do:

I wand to display a msgbox showing some current configuration
parameters when my VB2005 program starts up. However, I want the main
form to paint before the msgbox appears so that the main form appears
as the background to the msgbox. At present I just have the msgbox as
the last item in the Form.Load procedure but not surprisingly it's
appearing on its own and out of context before the main form is
visible.

Is there any event-dependent way of doing this other than using timers
of one sort or another?
May 30 '07 #2
On Wed, 30 May 2007 13:52:01 +0100, John Dann wrote:
Something very simple that I can't spot how to do:

I wand to display a msgbox showing some current configuration
parameters when my VB2005 program starts up. However, I want the main
form to paint before the msgbox appears so that the main form appears
as the background to the msgbox. At present I just have the msgbox as
the last item in the Form.Load procedure but not surprisingly it's
appearing on its own and out of context before the main form is
visible.

Is there any event-dependent way of doing this other than using timers
of one sort or another?
Use the Activated event instead of the Load event. The Activated event is
raised whenever the window has been shown on the screen. Note that this
event is raised *everytime* the window is shown on the screen (when it's
unminimized for example), so you'll want to unsubscribe from the event or
use a boolean flag to only show your message box the first time the event
is raised.

I think that in .NET 2, there is a new event that's raised only once the
first time that the window is shown. I haven't switched to .NET 2 yet so I
forgot the name but you might want to look for it.
May 30 '07 #3
Mehdi,

Yes, in .Net 2 the form now has a Shown event that is raised when the form
is first displayed.

I had not noticed that. Thanks for pointing it out.

Kerry Moorman
"Mehdi" wrote:
On Wed, 30 May 2007 13:52:01 +0100, John Dann wrote:
I think that in .NET 2, there is a new event that's raised only once the
first time that the window is shown. I haven't switched to .NET 2 yet so I
forgot the name but you might want to look for it.
May 30 '07 #4
"John Dann" <ne**@prodata.co.ukschrieb:
I wand to display a msgbox showing some current configuration
parameters when my VB2005 program starts up. However, I want the main
form to paint before the msgbox appears so that the main form appears
as the background to the msgbox. At present I just have the msgbox as
the last item in the Form.Load procedure but not surprisingly it's
appearing on its own and out of context before the main form is
visible.
The 'Load' event is raised prior to showing the form. The 'Form' class in
..NET 2.0 provides a 'Shown' event which can be utilized for a solution to
your question.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

May 30 '07 #5
Or you can do:

Private Sub Form_Load() Handles Mybase.Load

'..... Some stuff here

Me.Show()
Application.DoEvents()

'..... Possibly more stuff here

End Sub
Should work too...

Cheers,
Johnny J.

"Herfried K. Wagner [MVP]" <hi***************@gmx.atskrev i meddelandet
news:ee**************@TK2MSFTNGP04.phx.gbl...
"John Dann" <ne**@prodata.co.ukschrieb:
>I wand to display a msgbox showing some current configuration
parameters when my VB2005 program starts up. However, I want the main
form to paint before the msgbox appears so that the main form appears
as the background to the msgbox. At present I just have the msgbox as
the last item in the Form.Load procedure but not surprisingly it's
appearing on its own and out of context before the main form is
visible.

The 'Load' event is raised prior to showing the form. The 'Form' class in
.NET 2.0 provides a 'Shown' event which can be utilized for a solution to
your question.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

May 30 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Daniel Hill | last post by:
OK, I have very, VERY basic background knowledge of VB6 and have now upgraded to VB.NET and now I'm struggling to bring up the forms I want. What I am looking to do is to have a click a command...
1
by: phaseo | last post by:
I am having a weird problem with msgbox and other dialogs in VB.Net using Visual studio .Net 2003. The dialog box comes up with no text in it, not even the OK on the button. However when I step...
1
by: Will | last post by:
I have form showing instructions and logging actions and I would like the form to show a count down timer for a certain period of time. E.g. 30 secs, going down to 0 and then displaying the action....
1
by: Henry Lee | last post by:
hi , all This is driving me crazy , I use msgbox method in .net 2.0 environment and it is running fine on my IIS (Windows 2000) until today. The error is like "Showing a modal dialog box or form...
0
by: tweakmy | last post by:
Hi to all expert, ladies coders and gentlemen coders, I m quite newbie in this. I just started vb.net not long ago..because i was too crazy bout making an application for my own phone. as for now, i...
1
by: igor221189 | last post by:
Hello everyone. I have Access 2000 database which holds student records in the school.It stores subject grades for each student.In the 'Student Grade Form', I would like to search student surname...
3
by: RLN | last post by:
Re: Access 2003 I have a process that sends out emails to addresses (internally in our company). Form1 has all the main functionality/data, etc on it. When the user clicks "Send Emails" on...
1
vdraceil
by: vdraceil | last post by:
Hi everyone, I'm using VB6.I've lately been into working with APIs.I'm working on a program that makes the cursor rotate spirally and as it does so,any window opened will be minimized.The only way...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.