C# Update a Variable -


this question has answer here:

i want enter animals using variable. example:

private void button14_click(object sender, eventargs e) {     string newanimal;     newanimal = "pig";     if (textbox1 = newanimal)     {         //some other code      } } 

is possible update variable newanimal different animal, cow in different textbox, textbox2? cant figure out how update variable

thank you. beginner. appreciated.

here how put content of textbox2 newanimal string:

private void button14_click(object sender, eventargs e) {     string newanimal;     newanimal = "pig";     if (textbox1.text == newanimal)     {         newanimal = textbox2.text;     } } 

note check equality, should use == operator instead of =.


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -