How to refuse changes of controls in a form ?
-
Hi friends, Are there any methods to refuse changes of controls in a form ? For example: I have a form that include one text box: txtNumber, and one Exit button. At the first time, txtNumber.Text = "30" (When showing form) Then, I changed the its value into "45". After that, I don't want to accept changes, I clicked the Exit button. Then txtNumber.Text is still "45". I want this value is "30". Are there any method to refuse changes of TextBox in this case ? Thanks and regards,
-
Hi friends, Are there any methods to refuse changes of controls in a form ? For example: I have a form that include one text box: txtNumber, and one Exit button. At the first time, txtNumber.Text = "30" (When showing form) Then, I changed the its value into "45". After that, I don't want to accept changes, I clicked the Exit button. Then txtNumber.Text is still "45". I want this value is "30". Are there any method to refuse changes of TextBox in this case ? Thanks and regards,
Simply set the
ReadOnly
property totrue
to prevent anybody from being able to change it via the UI.*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier
-
Simply set the
ReadOnly
property totrue
to prevent anybody from being able to change it via the UI.*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier
-
Hi friends, Are there any methods to refuse changes of controls in a form ? For example: I have a form that include one text box: txtNumber, and one Exit button. At the first time, txtNumber.Text = "30" (When showing form) Then, I changed the its value into "45". After that, I don't want to accept changes, I clicked the Exit button. Then txtNumber.Text is still "45". I want this value is "30". Are there any method to refuse changes of TextBox in this case ? Thanks and regards,
Are you meaning that you want to be able to either commit the changes if a "save/Commit" button is pressed, and undo changes if the exit button is pressed? If that is the case, your exit button could simply trigger the method you used to set the values when showing the form.
-
Are you meaning that you want to be able to either commit the changes if a "save/Commit" button is pressed, and undo changes if the exit button is pressed? If that is the case, your exit button could simply trigger the method you used to set the values when showing the form.
-
Please, in future, try to be clearer with your questions. There is no way, from your original post, that I would have been able to guess what your question actually was.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier
-
Hi friends, Are there any methods to refuse changes of controls in a form ? For example: I have a form that include one text box: txtNumber, and one Exit button. At the first time, txtNumber.Text = "30" (When showing form) Then, I changed the its value into "45". After that, I don't want to accept changes, I clicked the Exit button. Then txtNumber.Text is still "45". I want this value is "30". Are there any method to refuse changes of TextBox in this case ? Thanks and regards,