We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Edit control content changed twice

Thread ID:

Created:

Updated:

Platform:

Replies:

12212 Mar 23,2004 11:08 PM UTC Mar 31,2004 01:06 PM UTC WinForms 3
loading
Tags: EditControl
Raymond S Gunawan
Asked On March 23, 2004 11:08 PM UTC

Hello, I am using an edit control, and I need to check the content of the control whenever there is a change in content. However, when I change the content of the control through code, the ContentChanged event is fired twice: first with the current content in e.Content, then with the correct text in e.Content. Am I doing something wrong? Thanks. Raymond.

Administrator [Syncfusion]
Replied On March 26, 2004 08:40 PM UTC

Hi Raymond Here is a sample created by modifying the EmbeddedInFile sample that ships with Essential Edit (version 2.0.3.0) to reproduce this issue. Pressing Button1 appends some text to the Edit Control and ContentChanged is called only once. Can you modify this sample to reproduce the problem so that we can take a look? Regards Arun

Administrator [Syncfusion]
Replied On March 29, 2004 06:21 PM UTC

Hi Arun, I am using this.editControl1.Text = "Hellow"; to change the text (because it is at initialization). If you change this line: this.editControl1.AppendText("Test"); to this.editControl1.Text = "Hellow"; in the button1_click event, you''ll get 2 content_changed event. Thanks. Raymond >Hi Raymond > >Here is a sample created by modifying the EmbeddedInFile sample that ships with Essential Edit (version 2.0.3.0) to reproduce this issue. Pressing Button1 appends some text to the Edit Control and ContentChanged is called only once. > >Can you modify this sample to reproduce the problem so that we can take a look? > >Regards >Arun >

Administrator [Syncfusion]
Replied On March 31, 2004 01:06 PM UTC

Hi Raymond, That is the correct and intented behavior as when you call: this.editControl1.Text = "Hello"; the EditControl first clears the existing text and then adds the new text. To understand this better modify the earlier sample by adding: private void editControl1_ContentChanged(object sender, Syncfusion.Windows.Forms.Edit.ContentChangedEventArgs e) { MessageBox.Show("e.text=\n" + e.Text + "\n\neditControl1.Text=\n" + this.editControl1.Text); } private void button1_Click(object sender, System.EventArgs e) { this.editControl1.Text = "Hello"; } When you press button1, you will see that the first time ContentChanged is called the Editcontrol''s text is cleared and e.Text contains the text that is being removed. The second time ContentChanged is called e.text has the text that will be the text of the EditControl. Hope this explanation clears any doubts you may have with this behavior. Do let us know if you have any further questions. Regards Arun

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;