[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Why is messagebox displayed behind the application?

Posted on 2011-09-13
9
Medium Priority
?
345 Views
Last Modified: 2012-05-12
I have a regular message box popping up from the server side (see code below). It works fine, but it pops up frequently behind the application at the very initial one or two poppings. I can see the messagebox icon on the bottom window bar (see attached). If I minimize the appliation, I can see the message box. See the attached. I can choose OK or Cancel on the box. It seems that it won't display behind the application again after that. If I did not minimize the application and I did not see the icon, I would not be able to respond the messagebox, and the application would be hanging up.

I'm wondering why that happens? How can I fix it?

protected void DevSelected(object sender, System.EventArgs e)
{
     ... ...
     if (MessageBox.Show("Are you sure you want to make a switch and ignore data on this page?", "Confirm Switch", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                .......
            }
            else
                ......
}
     

See-the-last-icon.doc
0
Comment
Question by:minglelinch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
9 Comments
 
LVL 40
ID: 36529491
Since it happens only on the first showing, I suspect that DevSelected is called before the application has had time to display its form. So the form appears over the MessageBox.

Try System.Windows.Forms.Application.DoEvents ( ); just before showing the MessageBox. This instruct the application to finish processing its event queue, leaving the time for the form to display before going for the MessageBox.
0
 
LVL 1

Author Comment

by:minglelinch
ID: 36529622
I tried System.Windows.Forms.Application.DoEvents ( ); it happens again at the second and the third popping. After that, it works fine.

It seems happening at the second time always.

Please help. I really need it resolved. Thanks.
0
 
LVL 1

Author Comment

by:minglelinch
ID: 36529634
This is how I put the statement

protected void DevSelected(object sender, System.EventArgs e)
{
     ... ...
     System.Windows.Forms.Application.DoEvents();
     if (MessageBox.Show("Are you sure you want to make a switch and ignore data on this page?", "Confirm Switch", MessageBoxButtons.YesNo) == DialogResult.Yes)
      {
         ... ...
      }
      ... ...
}
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 40
ID: 36529840
Is DevSelected inside of the application that displays the form, or in an external dll? The DoEvents should be in the application.

Could you post the code that calls DevSelected? This would enable us to see the event that is calling it as well as what is happening just before. A copy of the Stacktrace could also be useful.
0
 
LVL 1

Author Comment

by:minglelinch
ID: 36530086
Thank you so much for hte help.

Please see the attached file which contains related information.

How can I get a copy of Stacktrace ?

MessageDisplay.txt
0
 
LVL 40
ID: 36530186
Oops! ASP. Sorry, not by field.

I hope somebody can take the lead from here.
0
 
LVL 1

Author Comment

by:minglelinch
ID: 36530441
ASP.NET /C#
0
 
LVL 4

Accepted Solution

by:
AnuTiji earned 2000 total points
ID: 36541308
Hi

Please refer the below link for keeping the message box on top of all the applications

http://www.codeproject.com/KB/install/TopMostMessageBox.aspx
0
 
LVL 1

Author Closing Comment

by:minglelinch
ID: 36557016
That's a nice answer. It eventually works. Thanks a lot.
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question