There is a textBox1. Code:

this->textBox1->Location = System::Drawing::Point(233, 20); this->textBox1->Name = L"textBox1"; this->textBox1->Size = System::Drawing::Size(100, 20); this->textBox1->TabIndex = 4; this->textBox1->TextChanged += gcnew System::EventHandler(this, &Form1::textBox1_TextChanged); 

And there is a button (that's where the type is when it is pressed). Code:

 private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { // тут например арифметические действия с числом textBox1->TextChanged } 

How to read the value of textBox1->TextChanged and in the button convert the type of this value into an int?

  • @Anatoly Kozlov, To format the code, select it with the mouse and click on the button 101010 of the editor. - Nicolas Chabanovsky

2 answers 2

textBox1->TextChanged is an event whose processing, judging by your code, is delegated to the textBox1_TextChanged method. Most likely, you are interested in the value of the textBox1->Text property, which is of type string . And in order to get an integer from a string, you need to use one of the overloaded static Parse methods of type System::Int32 .

    System::Int32::Parse

      Protected by a community spirit 10 Apr '15 at 12:01 .

      Thank you for your interest in this issue. Since he collected a large number of low-quality and spam responses, which had to be deleted, now it’s necessary to have 10 reputation points on the site (the bonus for account association is not counted ).

      Maybe you want to answer one of the unanswered questions ?