Sea trying to change the RichTextBox does not work ?


Author
Message
Dong Trien Lam
Dong Trien Lam
StrataFrame User (173 reputation)StrataFrame User (173 reputation)StrataFrame User (173 reputation)StrataFrame User (173 reputation)StrataFrame User (173 reputation)StrataFrame User (173 reputation)StrataFrame User (173 reputation)StrataFrame User (173 reputation)StrataFrame User (173 reputation)
Group: Anonymous / Guest
Posts: 57, Visits: 251
Drag and drop RichTextBox  into form in the Form_Load and his running assign content for events RichTextBox_TextChanged RichTextBox but not running although I have to add this line of code:
this.RichTextBox.TextChanged + = new System.EventHandler (this.RichTextBox_TextChanged);
before Form_Load
[CODE]
public Form1()
{
            InitializeComponent();
            this.RichTextBox.TextChanged + = new System.EventHandler (this.RichTextBox_TextChanged);
            this.Load += new System.EventHandler(this.Form1_Load);
}

private void RichTextBox_TextChanged (object sender, System.EventArgs e)
{
     do something ...
}
[/ CODE]
as an example of his small examples on running normally, but in the main program will not run, I do not know what is not right ? What advice can you help me fix this.
StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Did you try adding your event handler through the property sheet?  Select the RichTextBox, click the lightning bolt icon in the property sheet and double-click TextChanged.  This will add the event handler inside the InitializeComponent() method which is called before anything else.
Dong Trien Lam
Dong Trien Lam
StrataFrame User (173 reputation)StrataFrame User (173 reputation)StrataFrame User (173 reputation)StrataFrame User (173 reputation)StrataFrame User (173 reputation)StrataFrame User (173 reputation)StrataFrame User (173 reputation)StrataFrame User (173 reputation)StrataFrame User (173 reputation)
Group: Anonymous / Guest
Posts: 57, Visits: 251
this case I also tried it but do not be. I also tried it but not even me to code like this is not an error
  
public Form1()
{
     InitializeComponent();          
     this.rtPad.TextChanged += new System.EventHandler(this.rtPad_TextChanged);
     this.rtPad.TextChanged += new System.EventHandler(this.rtPad_TextChanged);
     this.rtPad.TextChanged += new System.EventHandler(this.rtPad_TextChanged); 
 
rtPad is RichTextBox 
Edited 7 Years Ago by Dong Trien Lam
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search