【发布时间】:2011-11-08 02:43:27
【问题描述】:
在制作程序时,我不断收到此错误,如下所示:
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?