Нажмем правой кнопкой мыши на название проекта, затем ADD – New Item

Или Project- Add Class

Возникает окно, нажать на Class.

Название желательно изменить
Расширение класса cs.
В примере с сараем
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WindowsFormsApplication1
{
class Shed
{
public int Heigth { get; set; }
private int glubina;
public int Glubina
{
get { return glubina; }
set { glubina = value; }
}
private int width;
public int Width
{
get { return width; }
set
{
if (value > 0 && value < 100)
width = value;
}
}
public int VVV()
{
return Width * Heigth * Glubina;
}
}
}

В кнопке пишем
private void button1_Click(object sender, EventArgs e)
{
var shed1 = new Shed();
shed1.Width = Convert.ToInt16(textBox1.Text);
shed1.Heigth=Convert.ToInt16(textBox2.Text);
shed1.Glubina=Convert.ToInt16(textBox3.Text);
int V = shed1.VVV();
label1.Text = V.ToString();
}
Использование класса для работы с комплексными числами
Класс Compl
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WindowsFormsApplication1
{
class Compl
{
public double x1 { get; set; }
public double x2 { get; set; }
public double y1 { get; set; }
public double y2 { get; set; }
public double SumRe()
{
return x1 + x2;
}
public double SumIm()
{
return y1 + y2;
}
public double RaznRe()
{
return x1 - x2;
}
public double RaznIm()
{
return y1 - y2;
}
public double PrRe()
{
return x1 * x2 - y1 * y2;
}
public double PrIm()
{
return x1 * y2 - x2 * y1;
}
public double DelRe()
{
return (x1 * x2 + y1 * y2) / (x2 * x2 + y2 * y2);
}
public double DelIm()
{
return (x2 * y1 - x1 * y2) / (x2 * x2 + y2 * y2);
}
public double Mo()
{
return Math.Sqrt(x1 * x1 + y1 * y1);
}
}
}
Форма

Основная программа
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
var shed1 = new Compl();
shed1.x1 = Convert.ToDouble(textBox1.Text);
shed1.x2 = Convert.ToDouble(textBox3.Text);
shed1.y1 = Convert.ToDouble(textBox2.Text);
shed1.y2 = Convert.ToDouble(textBox4.Text);
double X=shed1.SumRe();
textBox5.Text=X.ToString();
double Y=shed1.SumIm();
textBox6.Text=Y.ToString();
}
private void button2_Click(object sender, EventArgs e)
{
var shed1 = new Compl();
shed1.x1 = Convert.ToDouble(textBox1.Text);
shed1.x2 = Convert.ToDouble(textBox3.Text);
shed1.y1 = Convert.ToDouble(textBox2.Text);
shed1.y2 = Convert.ToDouble(textBox4.Text);
double X = shed1.RaznRe();
textBox5.Text = X.ToString();
double Y = shed1.RaznIm();
textBox6.Text = Y.ToString();
}
private void button3_Click(object sender, EventArgs e)
{
var shed1 = new Compl();
shed1.x1 = Convert.ToDouble(textBox1.Text);
shed1.x2 = Convert.ToDouble(textBox3.Text);
shed1.y1 = Convert.ToDouble(textBox2.Text);
shed1.y2 = Convert.ToDouble(textBox4.Text);
double X = shed1.PrRe();
textBox5.Text = X.ToString();
double Y = shed1.PrIm();
textBox6.Text = Y.ToString();
}
private void button4_Click(object sender, EventArgs e)
{
var shed1 = new Compl();
shed1.x1 = Convert.ToDouble(textBox1.Text);
shed1.x2 = Convert.ToDouble(textBox3.Text);
shed1.y1 = Convert.ToDouble(textBox2.Text);
shed1.y2 = Convert.ToDouble(textBox4.Text);
double X = shed1.DelRe();
textBox5.Text = X.ToString();
double Y = shed1.DelIm();
textBox6.Text = Y.ToString();
}
}
}