user2768702
user2768702

Reputation:

I want to display in value in textbox, without clicking button. just update the value

I am just multiplying 10 and data(int),I want to display data in textbox, i don't want to update value by clicking button or something. I want trigger it by the text box event only. it automatically should update it.I am using vc++ 2010, windows form application.

this is my code:

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

       unsigned long data = 10;
       unsigned long value;

       value=5*data;

       String^ str = value.ToString();

       textBox1->Text=System::String^ str;


 }

Upvotes: 1

Views: 1819

Answers (1)

Ben
Ben

Reputation: 35663

You need to put the result of the calculation in a different textbox to the one you are typing in.

As it is, when you put the new value in, it will fire the event and set it to 50 again. Which will do it again. And again. Forever. Or until the program crashes.

Upvotes: 0

Related Questions