c#中怎么释放一个字符串变量的值

来源:百度知道 编辑:UC知道 时间:2024/06/07 10:34:39
我在做计算器的时候,当我点击了加号按钮,本想输入第二个数,但结果还是接着第一个数如:我第一个数是12,在按加号按钮本想输入第二个数4;但结果确是124.我把这个字符串定义s.在加号按钮下我把s=NULL还是不行,并用了一个变量作为是输入第二数的标志整型d=1所以请教各位大哥大姐帮忙!

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace HaoltCalculator
...{
public partial class _MainFrm : Form
...{
private double nPrevValue = 0;//上一次值
private bool bAppend = true;//用户按的数字是否连接在显示的数字后面
private string strPrevOpar = "";//上一次的操作符号

public _MainFrm()
...{
InitializeComponent();
}

private void NumButton_Click(object sender, EventArgs e)
...{
if (bAppend)...{//在追加状态
Button btn = sender as Button;
if (btn.Text=="0")...{
if (textBoxResult.Text == "") ...{
textBoxResult.Text += "0";