Hi…,
I wanated to limit the number of rows that can be added to the memo edit to three; please guide in acheiving this…
Regards,
Thameem
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Hello Thameem,
The MemoEdit control doesn't have a property to limit number of lines. You can use the following code instead:
private void memoEdit1_EditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e) {
string s = e.NewValue as string;
int index1 = s.IndexOf("\r\n");
if(index1 >= 0 && s.IndexOf("\r\n", index1 + 2) >= 0)
e.Cancel = true;
}
See also limited number of lines in a memoedit.
Thank you,
Paul
Thanks Paul,
The sample is for liming 2 row's i want to limit it for 3 row's… with that sample i am not able to understand whats happening and how i can change it accoring to my need… please suggest…
Regards,
Thameem.
Hello Thameem,
The code for 3 lines is:
private void memoEdit1_EditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e) { string s = e.NewValue as string; int index1 = s.IndexOf("\r\n"); int index2 = s.IndexOf("\r\n", index1 + 2); int index3 = s.IndexOf("\r\n", index2 + 2); if(index1 >= 0 && index2 >= 0 && index3 >= 0) e.Cancel = true; }
Thank you,
Paul