简体   繁体   中英

Show the user how many remaining chars left to him on a memoEdit

I have a memoEdit on my form, And I limited the user for 1024 chars. I added a Label under this memoEdit (as I marked in the attached image), and I want when the user create something on this memoEdit to show him the remaining chars. How can I do that ?

the attached image:

Check the MemoEdit Members documentation

EditValueChanged - Fires immediately after the edit value has been changed. (Inherited from BaseEdit)

EditValueChanging - Fires when the editor's value is about to be changed. (Inherited from BaseEdit)

void me_EditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e)
{
   var memo = (sender as MemoEdit);
   var maxChars = memo.Properties.MaxLength;
   lblContactWithCharCount.Text = memo.Text.Length + "/" + maxChars;
}

Check the another solution for this: Add character counter to MemoExEdit control

Subscribe to the Popup Event of the MemoExEdit control, then inside that subscribe to the EditValueChanging Event.

Hope this help..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM