[Mono-winforms-list] Question about MessageBox()

Sandy Armstrong sanfordarmstrong at gmail.com
Sun Jun 22 21:10:46 EDT 2008

On Sun, Jun 22, 2008 at 2:29 PM, Anthony Papillion <papillion at gmail.com> wrote:
> On Sat, Jun 21, 2008 at 7:33 AM, Sandy Armstrong
> <sanfordarmstrong at gmail.com>te:
> <snip>
>> > All I wanted to do was to display a messagebox. So I used typical .NET
>> > syntax as:
>> >
>> > MessageBox.Show("Hello C# World!", "Hello World", MessageBoxButtons.OK,
>> > MessageBoxIcon.Exclamation);
>> >
>> > When I tried to compile it, I was told that the system didn't know what
>> > MessageBox was in the current context. When I tried to add a reference
>> > to
>> > the System.Windows.Forms I couldn't do it as the MonoDevelop enviroment
>> > had
>> > no idea what I was talking about and told me the type or namespace
>> > didn't
>> > exist.
>> First, do you have libmono-winforms2.0-cil installed?
>> Second, did you remember to add a System.Windows.Forms reference to
>> the project itself?
>> Third, do you have the correct using statements in you C# files?
>> Sandy
> Hi Sandy,
> I don't think I did install libmono-winforms2.0-cil at all. I assumed that
> everything would be installed when I installed MonoDevelop. I'll try that

MonoDevelop is just an IDE...it does not require you to have every
Mono-related library/package installed.  In the future if you can't
get a reference to something you expect to be there, make sure to
check in your package manager. :-)

> today. I also didn't add a reference to the library in the project so that
> would be a problem too.

Yes, MonoDevelop should work very similarly to Visual Studio or
SharpDevelop, if you've used those before.

> Finally, I at least did get the using statements right (I think). I added:
> using System.Windows.Forms;
> to the using area of the file. Is this right?

Yes, that's right.  I assume you have that MessageBox line in a static
Main method in a class...but this isn't the place to get C#
support...there are plenty of tutorials out there if you're new to the
language (try codeproject.com).  Let us know if you have any troubles
getting MonoDevelop up and running.

Have fun,

More information about the Mono-winforms-list mailing list