Click here to Skip to main content
15,880,392 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I want that this program do + and - both of them

#pragma endregion
	private: System::Void textBox1_TextChanged(System::Object^  sender, System::EventArgs^  e) {

				 int a,b;
				 a=int::Parse(textBox1 ->Text);
			     //b=int::Parse(textBox2 ->Text);

			 }
	private: System::Void textBox2_TextChanged(System::Object^  sender, System::EventArgs^  e) {

			     int a,b;
				 a=int::Parse(textBox1 ->Text);
			     b=int::Parse(textBox2 ->Text);

			 }
	private: System::Void textBox3_TextChanged(System::Object^  sender, System::EventArgs^  e) {


				 int a,b;
				 a=int::Parse(textBox1 ->Text);
			     b=int::Parse(textBox2 ->Text);

			 textBox3 -> Text =(a+b).ToString();
    	
			 textBox3 -> Text =(a-b).ToString();

		
				

			 }
	private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {

				 
				 int a,b;
				 a=int::Parse(textBox1 ->Text);
			     b=int::Parse(textBox2 ->Text);

				 textBox3 -> Text =(a+b).ToString();

			 }
private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e) {
					 int a,b;
				 a=int::Parse(textBox1 ->Text);
			     b=int::Parse(textBox2 ->Text);

				 textBox3 -> Text =(a-b).ToString();
		 
		 
		 }
Posted
Updated 26-May-10 22:43pm
v7

1 solution

What is your problem?
Your code comes down to:
textBox1 changes: set textBox3 to textbox 1
textbox2 changes: set textbox3 to textbox 2
anything changes textBox3, including either of the above, set textBox3 to the sum of textBox1 and textBox2. This is in itself a change to textBox3, so do it again. And again, probably. Repeat until very bored, or it all throws an exception...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900