Mam nowy problem.
Problem zaczyna się gdy włączę ponownie program. (W TXB_1 wyświetla się poprzedni wynik, więc pół biedy), ale gdy napiszę np.5 i kliknę "+" bądź "-" program kasuje poprzedni wynik i wstawia 5. Powinno być tak, że jeżeli ostatni wynik wynosi 10, to po kliknięciu "5", następnie "+" powinno być wyświetlone "15".
Później już wszystko idzie normalnie, ale zależy mi na ciągłości.
kod:
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace skarbonka
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
double a; //liczba wpisana przez nas
double result = 0;
private void Dodawanie_Click(object sender, RoutedEventArgs e)
{
a = double.Parse(TXB_2.Text);
result += a;
TXB_1.Text = (result.ToString());
TXB_2.Text = "";
}
private void Odejmowanie_Click(object sender, RoutedEventArgs e)
{
a = double.Parse(TXB_2.Text);
result -= a;
TXB_1.Text = (result.ToString());
TXB_2.Text = "";
}
private void Usuwanie_Click(object sender, RoutedEventArgs e)
{
TXB_1.Text = "";
}
private void B_1_Click(object sender, RoutedEventArgs e)
{
TXB_2.Text = TXB_2.Text + "1";
}
private void B_2_Click(object sender, RoutedEventArgs e)
{
TXB_2.Text = TXB_2.Text + "2";
}
private void B3_Click(object sender, RoutedEventArgs e)
{
TXB_2.Text = TXB_2.Text + "3";
}
private void B4_Click(object sender, RoutedEventArgs e)
{
TXB_2.Text = TXB_2.Text + "4";
}
private void B5_Click(object sender, RoutedEventArgs e)
{
TXB_2.Text = TXB_2.Text + "5";
}
private void B6_Click(object sender, RoutedEventArgs e)
{
TXB_2.Text = TXB_2.Text + "6";
}
private void B7_Click(object sender, RoutedEventArgs e)
{
TXB_2.Text = TXB_2.Text + "7";
}
private void B8_Click(object sender, RoutedEventArgs e)
{
TXB_2.Text = TXB_2.Text + "8";
}
private void B9_Click(object sender, RoutedEventArgs e)
{
TXB_1.Text = TXB_1.Text + "9";
}
private void B0_Click(object sender, RoutedEventArgs e)
{
TXB_2.Text = TXB_2.Text + "0";
}
private void skarbonka_Closed(object sender, System.EventArgs e)
{
TXB_1.Text = Properties.Settings.Default.textbox;
Properties.Settings.Default.Save();
}
private void skarbonka_Load(object sender, RoutedEventArgs e)
{
TXB_1.Text = Properties.Settings.Default.textbox;
//wydaje mi się że tutaj coś powinno być
}
}
}
screeny:
- 0a36d9d162.png (160 KB) - ściągnięć: 119
- e1652c268f.png (136 KB) - ściągnięć: 139