It is necessary to call an event handler for pressing a button when another button is pressed. They are located on different tabs of the tabcontrol, if this is important.
private: System::Void button5_Click(System::Object^ sender, System::EventArgs^ e) { ofstream out; out.open("Genom/UserSequence.txt"); marshal_context ^ context = gcnew marshal_context(); const char* UserSequence = context->marshal_as<const char*>(richTextBox1->Text); out << UserSequence; textBox1->Text = "Genom/UserSequence.txt"; //button1_Click(nullptr, nullptr); button1->PerformClick(); } In a step-by-step check, it comes to the line with the call, slips, but it does not get to this function
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { // тут много кода, не вижу смысла копировать, до него все равно не доходит } The commented out option doesn't work either. All buttons were created in the constructor, that is, they were automatically created. If you manually click on button1, then everything works.
MS Visual Studio 2013