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 WindowsFormsApplication1
{
public partial class partialclass : Form
{
public
partialclass()
{
InitializeComponent();
}
partial
class bank
{
private
int mbalance = 3000;
public
int balance
{
get
{ return mbalance;}
set
{mbalance =value;}
}
}
partial
class bank
{
public
void deposit(int
amount)
{
balance = balance + amount;
}
public
void withdraw(int
amount)
{
balance = balance - amount;
}
}
bank
b = new bank();
private
void showbal()
{
label1.Text = b.balance.ToString();
textBox1.Text = "";
textBox1.Focus();
}
private
void partialclass_Load(object
sender, EventArgs e)
{
label1.Text = b.balance.ToString();
}
private
void button1_Click(object
sender, EventArgs e)
{
b.deposit(Int32.Parse(textBox1.Text));
showbal();
}
private
void button2_Click(object
sender, EventArgs e)
{
b.withdraw(Int32.Parse(textBox1.Text));
showbal();
}
}
}
No comments:
Post a Comment