MemoEdit 에 라인수를 제한하고 싶은경우


void memoEdit_EditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e)
{
            string s = e.NewValue as string;
            int index = 0;
            int lineCount = 0;
            int startIndex = 0;


            while ((index = s.IndexOf( "\r\n" , startIndex)) >= 0)
            {
                startIndex = index + 2;
                lineCount++;
            }


            if (lineCount > 9)
            {
                XtraMessageBox.Show(this, "최대 10줄까지 입력가능합니다.", "입력제한알림", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                e.Cancel = true;
            }

        }



참고

http://www.devexpress.com/Support/Center/Question/Details/Q51262


한라인의 문자수를 제한하고 싶은경우 참고

http://www.devexpress.com/Support/Center/Question/Details/Q21297 

반응형

+ Recent posts