Monday 2 January 2012

Textbox value null and pass value in textbox Advance code

Textbox Clear function

If you want to clear all textbox of form us this code

  private void Initailizetxt()//---form load call
        {
            TextBox[] txtZero = { txtQTYgrosswt, txtLessWt1, txtLessWt2, txtLessWt3, txtLessWt4, txtLessWt5,txtTotalLessWt,txtNetWt };
            for (int i = 0; i < txtZero.Length; i++)
            {
                txtZero[i].Text = "0";
            }
        }


taken all text box in textbox type array then check the length  the clear all thex box or initialize value...

  private void Initailizetxt()//---form load call
        {
            TextBox[] txtZero = { txtQTYgrosswt, txtLessWt1, txtLessWt2, txtLessWt3, txtLessWt4, txtLessWt5,txtTotalLessWt,txtNetWt };
            for (int i = 0; i < txtZero.Length; i++)
            {
                txtZero[i].Text = "";//-- textbox blank or SYSTEM.Clear()
            }
        }

1 comment: