Esempio n. 1
0
        private void button16_Click(object sender, EventArgs e)
        {
            ClsBanking rr = new ClsBanking();

            //屬性多載 索引子
            MessageBox.Show(rr[1].ToString());
            MessageBox.Show(rr["1"].ToString());
        }
Esempio n. 2
0
        private void button12_Click(object sender, EventArgs e)
        {
            //可以給予不同存取規則
            ClsBanking user1 = new ClsBanking();

            MessageBox.Show(user1.P4.ToString());
            //無法set user1.P4=99;
        }
Esempio n. 3
0
        private void button22_Click(object sender, EventArgs e)
        {
            ClsBanking user = new ClsBanking();//建構子

            MessageBox.Show(user._balance.ToString());
            ClsBanking user2 = new ClsBanking(1000);//建構子

            MessageBox.Show(user._balance.ToString());
        }
Esempio n. 4
0
        private void button18_Click(object sender, EventArgs e)
        {
            ClsBanking user = new ClsBanking();

            user.Disposed();//......

            //using (ClsBanking user2 = new ClsBanking())//interface
            //{

            //}
        }
Esempio n. 5
0
        private void button10_Click(object sender, EventArgs e)
        {
            ClsBanking user1 = new ClsBanking();

            MessageBox.Show(user1[0].ToString());
            try
            {
                MessageBox.Show(user1[10].ToString());
            }
            catch (IndexOutOfRangeException EX)
            {
                MessageBox.Show(EX.Message);
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message);
            }
        }
Esempio n. 6
0
 private void button1_Click(object sender, EventArgs e)
 {
     user1 = new ClsBanking();
     MessageBox.Show(user1.balance.ToString("C2"));
 }
Esempio n. 7
0
        private void button21_Click(object sender, EventArgs e)
        {
            ClsBanking user = new ClsBanking();

            user = null;
        }