You are on page 1of 3

using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MyMethods
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

void TooNemeh()
{
int x, y, niilber;
x = Int32.Parse(textBox1.Text.Trim());
y = Int32.Parse(textBox2.Text.Trim());
niilber = x + y;
MessageBox.Show(niilber.ToString());
}
private void button1_Click(object sender, EventArgs e)
{
if(textBox1.Text.Trim()=="")
{
MessageBox.Show("nemegdeh toog oruulna uu");
}
else if(textBox2.Text.Trim()=="")
{
MessageBox.Show("nemeh toog oruulna uu");
}
else
{
TooNemeh(); //(x*x-y*y)/100=
textBox1.Clear();
textBox2.Clear();
}

}
void IlirhiilelBodoh()
{
double x, y, hariu;
x = double.Parse(textBox3.Text.Trim());
y = double.Parse(textBox4.Text.Trim());
hariu = (x * x - y * y) / 100;
MessageBox.Show(hariu.ToString());
}
private void button2_Click(object sender, EventArgs e)
{
if(textBox3.Text.Trim()=="" || textBox4.Text.Trim()=="")
{
MessageBox.Show("x,y toonuudiig oruulna uu");
}
else
{
IlirhiilelBodoh();//ilirhiilliig bodoh method duudlaa
textBox3.Clear();
textBox4.Clear();
}
}
void ToogUrjih(int x,int y) //2 argument huvisagch zarlalaa
{
int urjver = x * y; //argument huvisagchiig hereglen uidlee hiilee
MessageBox.Show(urjver.ToString());
}
private void button3_Click(object sender, EventArgs e)
{
if(textBox5.Text.Trim()=="" || textBox6.Text.Trim()=="")
{
MessageBox.Show("urjih bolon urjigdeh toog oruulna uu");
}
else
{
ToogUrjih(Int32.Parse(textBox5.Text.Trim()),
Int32.Parse(textBox6.Text.Trim()));
textBox5.Clear();
textBox6.Clear();
}
}

private void button4_Click(object sender, EventArgs e)


{
ToogUrjih(10, 89);
}
void ToirgiinTalbai(double Radius)
{
double Talbai = Math.PI * Radius * Radius;
MessageBox.Show(Math.Round(Talbai,3).ToString());
}
private void button5_Click(object sender, EventArgs e)
{
if(textBox7.Text.Trim()=="")
{
MessageBox.Show("radius oruulna uu");
}
else
{
ToirgiinTalbai(double.Parse(textBox7.Text.Trim()));
textBox7.Clear();
}
}
void TegshTooOloh(int orohtoo)
{
int i = 1;
while(i<=orohtoo)
{
if(i%2==0)
{
listBox1.Items.Add(i);
}
i = i + 1;
}
}
private void button6_Click(object sender, EventArgs e)
{
if(textBox8.Text.Trim()=="")
{
MessageBox.Show("too oruulna uu");
}
else
{
TegshTooOloh(Int32.Parse(textBox8.Text.Trim()));
textBox8.Clear();
}
}
}
}

You might also like