C# Update a Variable -
this question has answer here:
- c# string textbox 5 answers
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
Post a Comment