[MonoDevelop] A little more help required

Neil Munro neilmunro at gmail.com
Wed Nov 15 21:12:54 EST 2006


Hey many thanks for the link to the video clip of the hello world program i
did manage to get that program working, but I can't seem to get my own
programs working, what happens is, the program exists before i am done, the
program runs, but i can't see if it gets to what it's supposed to be doing
since it closes before i am ready for it to close. I can include my source
files if needed.

But here is my code, i am taking a wild guess that the onDelete.... function
is being called after the buttonGo click button is being pressed causing the
application to close, i may be wrong though.

using System;
using Gtk;

public class MainWindow: Gtk.Window
{
    protected Gtk.Entry entryNum2;
    protected Gtk.Entry entryNum1;
    protected Gtk.Entry entryResult;
    protected Gtk.Entry entrySign;
    protected Gtk.Button buttonGo;


    public MainWindow (): base ("")
    {
        Stetic.Gui.Build (this, typeof(MainWindow));
    }

    protected void OnDeleteEvent (object sender, DeleteEventArgs a)
    {
        Application.Quit ();
        a.RetVal = true;
    }

    protected virtual void buttonGoClicked(object sender, System.EventArgse)
    {
        //convert strings to ints
        int iNum1 = Convert.ToInt32(entryNum1);
        int iNum2 = Convert.ToInt32(entryNum2);

        if (entrySign.Text == "+")
        {
            string sTemp = Convert.ToString(iNum1 + iNum2);
            entryResult.Text = sTemp;
        }

        else if (entrySign.Text == "-")
        {
            string sTemp = Convert.ToString(iNum1 - iNum2);
            entryResult.Text = sTemp;
        }

        else if (entrySign.Text == "*")
        {
            string sTemp = Convert.ToString(iNum1 * iNum2);
            entryResult.Text = sTemp;
        }

        else if (entrySign.Text == "/")
        {
            string sTemp = Convert.ToString(iNum1 / iNum2);
            entryResult.Text = sTemp;
        }

        else
        {
            entryResult.Text = "Error!";
        }
    }
}

I realize my coding method may appear odd, but i made a simpler application,
and it didn't work, with the same fault, so i made what i thought would be a
program that worked, but it appears not. Any help would be appriciated.

Thanks
Neil Munro

-- 
Stay shiny
Keep Flyin'
----------------
Njal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monodevelop-list/attachments/20061116/47fec56a/attachment.html 


More information about the Monodevelop-list mailing list