winforms - How to enable a button that is disabled based on textBox? c# -


i got textbox load value database , button update changes based on value of textbox. need enabled button if textbox value changed. example, value textbox loads 3 if input again 3 in textbox button still disable. button enabled if changed value example 4 or number not 3.

cache original value somewhere compare in textchanged event

    private void textbox1_textchanged(object sender, eventargs e)     {         if (textbox1.text == originalvalue)         {             button1.enabled = false;         }         else          {             button1.enabled = true;         }     } 

alternatively, (see codesinchaos' comment below):

    private void textbox1_textchanged(object sender, eventargs e)     {         button1.enabled = textbox1.text != originalvalue;     } 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -