[Mono-winforms-list] MessageBox
Paul
paul@all-the-johnsons.co.uk
Sun, 24 Oct 2004 01:12:00 +0100
--=-gJDkbC68sK1970ifYQfm
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Hi,
I'm trying to get the following code to work. It will compile, but when
I run it, I get the following error
Unhandled Exception: System.InvalidOperationException: Already visible
forms cannot be displayed as a 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 <0x00058> (wrapper remoting-invoke-with-check)
System.Windows.Forms.Form:ShowDialog (System.Windows.Forms.IWin32Window)
in <0x00012> System.Windows.Forms.Form:ShowDialog ()
in <0x0004b> (wrapper remoting-invoke-with-check)
System.Windows.Forms.Form:ShowDialog ()
in <0x00038> MessageBoxForm:RunDialog ()
in <0x0004b> (wrapper remoting-invoke-with-check)
MessageBoxForm:RunDialog ()
in <0x00040> System.Windows.Forms.MessageBox:Show (string,string)
in <0x00142> PointTest.PointTest:Main (string[])
The code is this
using System;
using System.Windows.Forms
namespace PointTest
{
public class Point
{
private int x, y;
public Point()
{
}
public Point( int xValue, int yValue )
{
X =3D xValue;
Y =3D yValue;
}
public int X
{
get
{
return x;
}
set
{
x =3D value; // no need for validation
}
}
public int Y
{
get
{
return y;
} =20
set
{
y =3D value; // no need for validation
}
}
public override string ToString()
{
return "[" + x + ", " + y + "]";
}
}
class PointTest
{
static void Main( string[] args )
{
Point point =3D new Point( 72, 115 );
string output =3D "X coordinate is " + point.X +
"\n" + "Y coordinate is " + point.Y;
point.X =3D 10; // set x-coordinate via X property
point.Y =3D 10; // set y-coordinate via Y property
output +=3D "\n\nThe new location of point is " + point;
MessageBox.Show( output, "Demonstrating Class Point" );
}
}
}
mcs PointTest.cs -r:System.Windows.Forms
Is this a problem with MessageBox or something else?
TTFN
Paul
--=20
"Trust me, I know what I'm doing" - Det. Sledgehammer
--=-gJDkbC68sK1970ifYQfm
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
iD8DBQBBevNPusSVe5EZv3wRAoeeAJ0Sdx3e5xiSs9jTRwEGNPHpzn8W6wCgg2qe
KOJBCXrK58JiglRvG4IGihY=
=h8vY
-----END PGP SIGNATURE-----
--=-gJDkbC68sK1970ifYQfm--