我在製作下面給出的程序時不斷收到此錯誤:不斷收到此錯誤:事件'System.Windows.Controls.Primitives.ToggleButton.Checked'只能出現在+ =的左側或 - =
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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 simplecalc
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
int a, b, c;
a = int.Parse(textBox1.Text);
b = int.Parse(textBox2.Text);
if (rbadd.Checked == true)
c = a + b;
else if (rbsubtract.Checked == true)
c = a - b;
else if (rbdivide.Checked == true)
c = a/b;
else
c = a * b;
textBox3.Text = c.ToString();
}
}
}
我正在製作一個基於WPF的C#計算器。我對C#很陌生。
只是好奇,爲什麼這個問題+2? –