能不能让TEXTBOX里有值,但不是显示出来呢???????

解决方案 »

  1.   

    你的意思是设置Passwordchar为*??
      

  2.   

    this.textBox1.ForeColor = this.textBox1.BackColor;
      

  3.   

    将默认值存储在TextBox的tag属性里,没有值则取tag属性(要转为string)。
      

  4.   

    这样你干脆将TextBox的Text属性设为"",进行计算前判断参与计算的TextBox的TextBox属性是不是"",如果是就返回你的默认值就得了。
    如:
    public const int DefValue = 0xFF;
    public int ReturnVal(TextBox object){
      if(object.Text == "")
        return DefValue;
      else
        return Convert.ToInt32(object.Text);
    }public int YourMethod(){//你自己的方法、函数替换。
    ...
    ...
       int intRet = ReturnVal(TextBox1.Text) + ReturnVal(TextBox2.Text); //用你自己的代码替换
    ...
       return intRet;//用你自己的代码替换。
    }要不你就用 TabIndex 充当默认值也行,Text属性为空时返回TextBox的TabIndex属性。