Hidden MessageBox

0
0

Hi, I have always used MessageBoxes of this type in my applications:

public static Boolean MsgSinoAlert(string cText= “”)
{
Boolean lRet;

DialogResult oRes = MessageBox.Show(new Form() { TopMost = true },
cText,”Ok”,MessageBoxButtons.YesNo,MessageBoxIcon.Warning);

if (oRes == DialogResult.Yes)
{ lRet = true; }
else { lRet = false; }

return lRet;
}

With Wisej it often happens to me that the message is hidden and the application seems to be blocked, but it isn’t.
I tried with a new test app and can’t reproduce the problem. I can’t send the app I use because it’s too complicated, can you suggest how to replace all the messages with something that works for sure with Wisej?
Thanks for your help.

  • You must to post comments
0
0

Hello Francesco,

The issue lies within this line:
DialogResult oRes = MessageBox.Show(new Form() { TopMost = true },
cText,”Ok”,MessageBoxButtons.YesNo,MessageBoxIcon.Warning);

You’re assigning a new form as the owner, you shouldn’t do that.

If you want to assign an owner, pass the parent control, it should be DialogResult oRes = MessageBox.Show(this,”Ok”,MessageBoxButtons.YesNo,MessageBoxIcon.Warning);

Or you can simply ommit the owner parameter.

Best regards,
Alaa

//

  • Francesco Leo
    Ok, seems to work now, thanks!
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.