( ^__^ )     ( ^__^ )

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 郵資計算
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            if(System.Convert.ToInt16(textBox1.Text) <=20)

                MessageBox.Show("郵資" + "7" + "元");

            else if
  
            (System.Convert.ToInt16(textBox1.Text) <=100 & System.Convert.ToInt16(textBox1.Text) >20)

                MessageBox.Show("郵資" + "17" + "元");

            else if
           
                (System.Convert.ToInt16(textBox1.Text) <= 250 & System.Convert.ToInt16(textBox1.Text) > 100)

                MessageBox.Show("郵資" + "32" + "元");

            else if

                (System.Convert.ToInt16(textBox1.Text) <= 500 & System.Convert.ToInt16(textBox1.Text) > 250)

                MessageBox.Show("郵資" + "62" + "元");

            else if

                (System.Convert.ToInt16(textBox1.Text) <= 1000 & System.Convert.ToInt16(textBox1.Text) > 500)

                MessageBox.Show("郵資" + "108" + "元");

            else if

                (System.Convert.ToInt16(textBox1.Text) <=2000  & System.Convert.ToInt16(textBox1.Text) > 1000)

                MessageBox.Show("郵資" + "176" + "元");

            else

             
                MessageBox.Show("無法處理訊息!");

        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }
    }
}


執行結果

未命名.jpg 

創作者介紹

程式。生活錄

ㄡ ㄋㄧ' ㄦ 發表在 痞客邦 PIXNET 留言(1) 人氣()


留言列表 (1)

發表留言
  • 悄悄話
找更多相關文章與討論