Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

Regarding Enabling And disabling Textbox values

Last post 05-06-2008 12:48 AM by Tom-1984. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 05-05-2008 3:18 PM

    • flower123
    • Not Ranked
    • Joined on 10-05-2007
    • India
    • New Member
    • Points 95

    Regarding Enabling And disabling Textbox values

    Hi All,

      I want to enable my text box to enter values in it, if the check box is checked..

      If the check box is not checked , Then it should not allow the text box to enter values...

    I have tried like this,

    if(checkbox1.checked==true)

        textbox1.enabled=true;

    By default checkbox checked is false and text enabled is false..

     

    But it is not working in my coding......

     

    Anyone knows wat m doing wrong, tell me..

    Thanks in advance


     

    • Post Points: 10
  • 05-06-2008 12:48 AM In reply to

    • Tom-1984
    • Not Ranked
    • Joined on 08-24-2007
    • China
    • New Member
    • Points 35

    Re: Regarding Enabling And disabling Textbox values

    hi,flower123 ,

            you should write the code in the event of checkBox1_CheckStateChanged,as follows

             private void checkBox1_CheckStateChanged(object sender, System.EventArgs e)
            {
               if(checkBox1.Checked)
                {
                    textBox1.Enabled=true;
                }
               else
                {
                 textBox1.Enabled=false;
                }
           }

    • Post Points: 5
Page 1 of 1 (2 items)