Hi,

I am quite new with programming in C# and I have a beginners question.

I am trying to create a simple banking tool with WPF. My aim was to create it by using a seprate Class (bankrek).
For example, i enter an amount in a textbox, click add amount button and the amount will be displayed in a label which represents the total amount. Sounds rather simplistic but believe me, i am fighting with this for days. Why? Everytime when I put an amount in my "add" textbox it does put this amount also in the total amount label. So far so good. But if I try to add a next amount, the total amount label resets and only puts in the amount i just entered. Now, can anyone tell the beginner programmer how this could be possible? How can i just keep adding up my inserted amount to the total label? I would be very happy if someone cann solve this problem for me! Kind regards,
Fezza

I made the following maincode and separate :

maincode
namespace bankrekening
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
int addmoney;



public MainWindow()
{
InitializeComponent();

}

private void stortButton_Click(object sender, RoutedEventArgs e)
{

bankrek bank = new bankrek();
addmoney = Convert.ToInt32(stortTextBox.Text);
bank.Storting(addmoney);

//returns money to total amount
totaalBedragLabel.Content = Convert.ToString(bank.Stort);
}
}
}

now the code for the Class:

namespace bankrekening
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
int addmoney;



public MainWindow()
{
InitializeComponent();

}

private void stortButton_Click(object sender, RoutedEventArgs e)
{

bankrek bank = new bankrek();
addmoney = Convert.ToInt32(stortTextBox.Text);
bank.Storting(addmoney);

//returns money to total amount
totaalBedragLabel.Content = Convert.ToString(bank.Stort);
}
}
}