Reputation: 457
I'm trying to use Winforms for a simple application on my Mac in Mono C#, so far I've tested this code
using System;
using System.Drawing;
using System.Windows.Forms;
public class HelloWorld : Form
{
static public void Main ()
{
Application.Run (new HelloWorld ());
}
public HelloWorld ()
{
Button b = new Button ();
b.Text = "Click Me!";
b.Click += new EventHandler (Button_Click);
Controls.Add (b);
}
private void Button_Click (object sender, EventArgs e)
{
MessageBox.Show ("Button Clicked!");
}
}
But no window is opening when I test it, any help? I think my question is specific to Mono.
Upvotes: 6
Views: 3260
Reputation: 139
I just had the same problem. Not with Mono but with WinForms. For me the solution was:
Those above helped me. Of course I had to input any setting again, but at least I could use the application again.
Upvotes: 0
Reputation: 2787
i have the same issue, running os x mavericks + mono 3.2.3 .
i built the demos from here : http://mono-project.com/Mono_Basics , the first two worked (console+gtk) but the third (dotnet) does nothing when i run it from Terminal, doesn't throw any error, i only makes cpu load, but no window is shown...
in the end , i found the solution, on the first dotnet run, it takes about 1 minute until the window shows, on the next run it's instant. when i was testing, i was killing the process after 5-10 seconds, so that's why i didn't worked for me on first try...
Upvotes: 7