And second: (I cut out the Form designer part to fit it here)
Code:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WindowsApplication2
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.PictureBox pictureBox3;
private System.Windows.Forms.PictureBox pictureBox4;
private System.Windows.Forms.PictureBox pictureBox5;
private System.Windows.Forms.TextBox x;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public Form1() //constructor
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Form3 frm3=new Form3();
frm3.Show();
Application.Run();
}
private void Form1_Closed(object sender, System.EventArgs e)
{
Application.Exit();
}
public float cube(float s){return s*s*s;}
private void pictureBox1_Click(object sender, System.EventArgs e)
{
float side; side=float.Parse(x.Text);
MessageBox.Show("Volume of cube with side: "+ side+ " is: "+ cube(side));
x.Text="YOU GOT IT!!!!";
}
private void richTextBox1_TextChanged(object sender, System.EventArgs e)
{
}
private void Form1_Load(object sender, System.EventArgs e)
{
}
private void x_TextChanged(object sender, System.EventArgs e)
{
}
}
}