嗨,我对视觉工作室很陌生。
到目前为止,这是我制作自动取款机示例的代码,我有一个文本框,我输入了一个金额,然后我有这个按钮,我点击信用,它将金额添加到一个名为余额的标签,我还有一个名为借方的按钮将钱从余额中取出。我在 wpf c# 中这样做
到目前为止我有这个。
namespace BankAccounts
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private double totalamount = 0;
public string balance1;
private void buttoncredit_Click(object sender, RoutedEventArgs e)
{
totalamount = totalamount + double.Parse(textboxamount.Text)
balance1 = "Your Balance is: £";
label2.Content = balance1 + totalamount;
textboxamount.Clear();
}
private void buttondebit_Click(object sender, RoutedEventArgs e)
{
if (totalamount - double.Parse(textboxamount.Text) < 0)
{
MessageBox.Show("Overdraft Limit is not set please contact Customer Services");
}
else
{
totalamount = totalamount - double.Parse(textboxamount.Text);
balance1 = " Your Balance is: £";
label2.Content = balance1 + totalamount;
textboxamount.Clear();
}
}
private void listboxtransactions_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
}
}
}