开发者

C# MessageBox in mono not responding

I am a beginner with monodevelop , I am trying to display a message box based on button click . The code is working fine , except when the message bex under the if / else statements is displayed , i am not able to close it . Clicking "OK" or the "x" button noes not close the MessageBox

namespace SampleGtkProj
{
    public partial class First开发者_如何学Python : Gtk.Window
    {
        protected virtual void buttonClicked (object sender, System.EventArgs e)
        {
            MessageBox.Show(entry1.Text);
            if(File.Exists(entry1.Text)) {
                MessageBox.Show("File Exists: test passed");}
            else {
                MessageBox.Show("FIle DOes NOt exist test failed");}
        }

        public First() : base(Gtk.WindowType.Toplevel)
        {
            this.Build ();
        }
    }
}


Don't mix toolkits.

That is, don't call Winform's MessageBox inside of a Gtk# application. They use different message loops and you are asking for trouble.

Try using something like Gtk#'s MessageDialog.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜