displaying a dialog right after window is shown

  • Thread starter Thread starter JT
  • Start date Start date
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.
 
* "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?
 
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.
 
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.
 
Back
Top