displaying a dialog right after window is shown

J

JT

is there an event that is raised right after the window
is shown? i have been trying to create my main window and
as soon as thats done, then show a login dialog box. i
cant seem to figure out where to put the dialog display
code. ive tried in the constructor, the onload, and the
onenter, but they are raised before the window is
actually shown. ive also tried to keep track of the first
time shown like this

bool firstactivated = true;

protected override void OnActivated(EventArgs ea)
{
base.OnActivated(ea);
if(firstactivated)
dlg.ShowDialog(this);
firstactivated = false;
}

but for some reason this doesnt work. i dont get it.
please help. thanks.
 
H

Herfried K. Wagner [MVP]

* "JT said:
is there an event that is raised right after the window
is shown? i have been trying to create my main window and
as soon as thats done, then show a login dialog box. i
cant seem to figure out where to put the dialog display
code. ive tried in the constructor, the onload, and the
onenter, but they are raised before the window is
actually shown. ive also tried to keep track of the first
time shown like this

bool firstactivated = true;

protected override void OnActivated(EventArgs ea)
{
base.OnActivated(ea);
if(firstactivated)

\\\
{
firstactivated = false;
dlg.ShowDialog(this);
}
///

What doesn't work?
 
M

Michael Corcoran

If all else fails, (or if the following is good enough),
use the Timer component. Set the interval to something
really short and Enable the timer in the forms Load or
Activated event.
 
J

JT

the dialog box will display, but it does before the main
window displays and i was it the other way around. thanks
for the timer idea, but how would i know the value to set
it at if the load times are different for each user.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top