All pastes #181910 Raw Edit

Anonymous

public text v1 · immutable
#181910 ·published 2006-09-25 14:10 UTC
rendered paste body
using System;
using Gtk;

public class MainWindow: Gtk.Window
{	
	public MainWindow (): base ("")
	{
		Stetic.Gui.Build (this, typeof(MainWindow));
	}
	
	protected void OnDeleteEvent (object sender, DeleteEventArgs a)
	{
		Application.Quit ();
		a.RetVal = true;
	}

private void btnbutton1_Click(object sender, System.EventArgs e)
{
   txtErgebnis.Text = string.format("{0}", Int64.Parse(txtEntry1.Text) + Int64.Parse(txtEntry2.Text));
}

private void btnbutton2_Click(object sender, System.EventArgs e)
{
  string sentry1 = this.txtentry1.Text ;
  string sentry2 = this.txtentry2.Text ;
    try
    {
      double nentry1 = System.Convert.ToDouble (sentry1);
      double nentry2 = System.Convert.ToDouble (sentry2);
      if (nentry2!=0)
      {
        double nErgebnis = nentry1 / nentry2;
        this.txtErgebnis = nErgebnis.ToString ();
        }
        else
        {
            this.txtErgebnis.Text = "Division durch 0";
         }
     }
catch
{
   this.txtErgebnis.Text = "Keine Zahl angegeben!";
}
finally
{
}
}