views:

92

answers:

2

How do I add an event handler method to, say a TextBox's TextChanged event ?

+2  A: 

Example:

void SomeClass::TextChanged_Handler(Object ^sender, EventArgs ^e){
    System::Diagnostics::Debug::WriteLine(L"Text changed.");
}

void SomeClass::RegisterHandler(){
    textBox->TextChanged += gcnew EventHandler(this, &SomeClass::TextChanged_Handler);
}

See examples for EventArgs class on MSDN.

Vulcan Eager
+1  A: 

Here's a HOWTO on the MSDN site.

Ben Voigt