How to clear the text of all textBoxes in the form?

后端 未结 9 1533
长发绾君心
长发绾君心 2020-11-27 05:15
private void CleanForm()
{
    foreach (var c in this.Controls)
    {
        if (c is TextBox)
        {
            ((TextBox)c).Text = String.Empty;
        }
            


        
9条回答
  •  时光取名叫无心
    2020-11-27 05:55

    You can try this code

    protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
    
    
            if(keyData==Keys.C)
            {
                RefreshControl();
                return true;
            }
    
    
            return base.ProcessCmdKey(ref msg, keyData);
        }
    

提交回复
热议问题