I m trying to work with c# event handling and this is my code:
//
void TextChanged1(object sender, EventArgs e) //text change event{
foreach (RichTextBox rtf in pbxContainer.Controls){
if (rtf.Height > 984){
rtf.Height = 984;
rtf.Text =
"HELLO!!!!";}
}
}
//
and my error is below:
//creates a picturebox and a richtextbox from form load
private
void newRtfDocument(){
//new picture box to hold rtf documentpbxContainer.BackColor =
Color.White;pbxContainer.BorderStyle =
BorderStyle.FixedSingle;pbxContainer.Parent = pnlContainer;
pbxContainer.Height = 1184;
pbxContainer.Width = 832;
pbxContainer.Top = intPbxTop;
pbxContainer.Left = 90;
pbxContainer.BorderStyle =
BorderStyle.None;pbxContainer.Show();
//new rtf document createdrtfdocument2.Parent = pbxContainer;
rtfdocument2.ScrollBars =
RichTextBoxScrollBars.None;rtfdocument2.Height = 984;
rtfdocument2.Width = 732;
rtfdocument2.Top = intRtfTop;
rtfdocument2.Left = 50;
rtfdocument2.BorderStyle =
BorderStyle.None;rtfdocument2.TextChanged(TextChanged1); //error appears here!!
rtfdocument2.Show();
error appears above at //error appears here, the error is:
The event 'System.Windows.Forms.Control.TextChanged' can only appear on the left hand side of += or -=
So I was wondering why this error appears how would I fix it and anymore information that could help me!! if you need anymore information regarding this I will answer what I can, hope someone can help me!!

event handling
kendy
hi,
you decalare it wrong you suppose to do something like this
RichTextBox rtf1 = new RichTextBox();rtf2.TextChanged +=
new EventHandler(TextChanged1);more over i never try to add rich textbox to a picture box b4, if you want a container to hold all your richtextbox's you can use panel instead you will find it in the conatainer tab
hope this helps