[Mono-winforms-list] Messagebox error

Paul Johnson paul@all-the-johnsons.co.uk
Fri, 19 Nov 2004 16:40:05 +0000


Hi,

I'm using MWF built about 20 minutes ago from svn. My understanding is
that MessageBox should be working happily now. I'm getting an error when
I run this code

using System;
using System.Windows.Forms;

class Sum
{
  static void Main (string [] args)
  {
    int sum = 0;
    for (int n = 2; n <= 100; n += 2)
      sum += n;

    MessageBox.Show("The sum is " + sum,
                    "Sum even integers from 2 to 100",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information);
  }
}

mcs sum.cs -r:System.Windows.Forms
mono sum.exe

#region #line XplatUI Constructor called

Unhandled exception: System.InvalidOperationException: Already visible
forms can not be displayed as modal dialog. Set the Visible property to
'false' prior to calling Form.ShowDialog.
in <0x0008d> System.Windows.Forms.Form:ShowDialog
(System.Windows.Forms.IWin32Window)
in <0x0005b> (wrapper remoting-invoke-with-check)
System.Windows.Forms.Form:ShowDialog (System.Windows.Forms.IWin32Window)
in <0x00012> System.Windows.Forms.Form:ShowDialog()
in <0x00045> (wrapper remoting-invoke-with-check)
System.Windows.Forms.Form:ShowDialog()
in <0x00038> MessageBoxForm:RunDialog()
in <0x00045> (wrapper remoting-invoke-with-check)
MessageBoxForm:RunDialog()
in <0x0003c> System.Windows.Forms.MessageBox:Show
(string,string,System.Windows.Forms.MessageBoxButtons,
System.Windows.Forms.MessageBoxIcon)
in <0x00058> Sum:Main(string[])

This looks either an underlying problem but it is more likely some sort
of odd behaviour from MWF/MessageBox. Does this need entering into
bugzilla?

TTFN

Paul
-- 
"I'm gonna hit the highway like a battering ram with a Cilla Black fan on
the bike" - Meatloaf