private void button2_Click(object sender, EventArgs e)
        {
            textBox1.Select();
            textBox1.Copy();
}
点击button一下,就Copy选中的值,然后再点button一下就清空. 
这该怎么做

解决方案 »

  1.   

    设置一个标志。bool isFirst=true;private void button2_Click(object sender, EventArgs e)
    {
         if(isFirst){
                textBox1.Select();
                textBox1.Copy();
        }
        else
        {
               textBox1.Text=string.Empty;
        }
     
    }
      

  2.   

    记录在if为true的情况下加上isFirst=false;在else中加入isFirst=true;
      

  3.   

    up
    标记可以用HiddenField控件
      

  4.   

    设置标识
    bool flag=true;if(flag)
    {
    }
    else
    {textBox1.Text=String.Empty;}
    flag=!flag;