17-12-17, 11:40 AM
كود :
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 stock
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
textBox1.Text = "0";
textBox2.Text = "0";
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void textBox1_KeyUp(object sender, KeyEventArgs e)
{
double p, c, m;
if (textBox1.Text == "")
p = 0;
else
p = Convert.ToDouble(textBox1.Text);
if (textBox2.Text == "")
c = 0;
else
c = Convert.ToDouble(textBox2.Text);
m = p * c;
textBox3.Text = m.ToString();
}
private void textBox2_KeyUp(object sender, KeyEventArgs e)
{
double p, c, m;
if (textBox1.Text == "")
p = 0;
else
p = Convert.ToDouble(textBox1.Text);
if (textBox2.Text == "")
c = 0;
else
c = Convert.ToDouble(textBox2.Text);
m = p * c;
textBox3.Text = m.ToString();
}
}
}