Compiler Error C2659
Everything works fine, except when I try to define event functions. The code I entered is a replica of what VCPP .Net generates when assigning functions via the visual interface, changed to fit my context, but it complains that im trying to set a value to a function.
using namespace System;
using namespace System::Windows::Forms;
ref class HighlighterTextBox
{
public:
HighlighterTextBox(RichTextBox^richtextbox)
{
this->textbox=richtextbox;
this->textbox->OnTextChanged+=gcnew System::EventHandler(this,&HighlighterTextBox::Highlight);
}
private:
System::Windows::Forms::RichTextBox^textbox;
System::Void Highlight(System::Object^sender,System::EventArgs^e)
{
// Highlighting occures here
}
};
[/code]I have absolutly no clue what im suppose to do to fix this... Please help me :S

