C++ 向c++;文本框

C++ 向c++;文本框,c++,visual-studio,events,C++,Visual Studio,Events,我试图在C++中的文本框中添加事件处理程序,并得到以下错误: 错误1错误C2664:'void System::Windows::Forms::Control::KeyPress::add(System::Windows::Forms::KeyPressEventHandler^'):无法将参数1从'System::EventHandler^'转换为'System::Windows::Forms::KeyPressEventHandler^' 以下是我正在处理的代码: this->text

我试图在C++中的文本框中添加事件处理程序,并得到以下错误:

错误1错误C2664:'void System::Windows::Forms::Control::KeyPress::add(System::Windows::Forms::KeyPressEventHandler^'):无法将参数1从'System::EventHandler^'转换为'System::Windows::Forms::KeyPressEventHandler^'

以下是我正在处理的代码:

this->textBox2->Location = System::Drawing::Point(173, 31);
this->textBox2->Name = L"textBox2";
this->textBox2->Size = System::Drawing::Size(172, 20);
this->textBox2->TabIndex = 5;
this->textBox2->KeyPress += gcnew System::EventHandler(this, &MyForm::textBox2_keyUp);
下面是事件函数:

private: void textBox2_keyUp(Object^ sender, System::EventArgs^ e)
{
  phrase = textBox2->Text;
  MyForm::HighlightedNotRadioButton_CheckedChanged(sender, e);
}

什么引起错误?< /P>当TKBOX中调用KEYUP事件时,您到底想要发生什么?这不是C++,它不是C++或Cx或C++ + CLI,我不太清楚语法上的差别。当有人按下一个键时,我想要得到框中的文本,并把它放进我设置的字符串(短语)。然后调用我的突出显示函数