物件 : bindingSource 設定
DataGridView
2015年11月19日 星期四
2015年11月5日 星期四
簡易計算機
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void label2_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
label2.Text = (int.Parse(textBox1.Text) + int.Parse(textBox2.Text)).ToString();
// (int.Parse(Val1.Text) * int.Parse(Val2.Text)
}
private void button2_Click(object sender, EventArgs e)
{
label2.Text = (int.Parse(textBox1.Text) - int.Parse(textBox2.Text)).ToString();
}
private void button3_Click(object sender, EventArgs e)
{
label2.Text = (int.Parse(textBox1.Text) * int.Parse(textBox2.Text)).ToString();
}
private void button4_Click(object sender, EventArgs e)
{
if(int.Parse(textBox2.Text)==0)
{
label2.Text = "除數不可為零請從新輸入有效數字";
}
else
label2.Text = (float.Parse(textBox1.Text) / float.Parse(textBox2.Text)).ToString();
}
}
}
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void label2_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
label2.Text = (int.Parse(textBox1.Text) + int.Parse(textBox2.Text)).ToString();
// (int.Parse(Val1.Text) * int.Parse(Val2.Text)
}
private void button2_Click(object sender, EventArgs e)
{
label2.Text = (int.Parse(textBox1.Text) - int.Parse(textBox2.Text)).ToString();
}
private void button3_Click(object sender, EventArgs e)
{
label2.Text = (int.Parse(textBox1.Text) * int.Parse(textBox2.Text)).ToString();
}
private void button4_Click(object sender, EventArgs e)
{
if(int.Parse(textBox2.Text)==0)
{
label2.Text = "除數不可為零請從新輸入有效數字";
}
else
label2.Text = (float.Parse(textBox1.Text) / float.Parse(textBox2.Text)).ToString();
}
}
}
訂閱:
文章 (Atom)