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

Restrict the length of a pasted string

Thread ID:

Created:

Updated:

Platform:

Replies:

39782 Jan 18,2006 10:01 AM UTC Jan 18,2006 01:17 PM UTC WinForms 4
loading
Tags: GridControl
Fredrik Ström
Asked On January 18, 2006 10:01 AM UTC

Hi, I have searched the forums but cant find the solution to what seems like a very silly problem; The user is only allowed to enter max 30 chars in a grid cell. I can handle the typing of chars in the CurrentCellKeyPress event, but when the user paste into the cell my length restriction gets bypassed. How do i interrupt the paste process so only the first 30 chars end up in the cell? regards Fredrik

stanleyj [Syncfusion]
Replied On January 18, 2006 12:16 PM UTC

Hi Fredrik, Try handling PasteCellText to strip off the extra characters. private void gridControl1_PasteCellText(object sender, GridPasteCellTextEventArgs e) { string s = e.Text; e.Text = s.Remove(30,(s.Length-30)); } Best regards, Stanley

Fredrik Ström
Replied On January 18, 2006 01:16 PM UTC

Thanx for the answer Stanley, but the I don''t seem to get the PasteCellText event. I do get the ClipboardPaste though. regards Fredrik

Fredrik Ström
Replied On January 18, 2006 01:17 PM UTC

Thanx for the answer Stanley, but the I don''t seem to get the PasteCellText event. I do get the ClipboardPaste though. regards Fredrik

Fredrik Ström
Replied On January 18, 2006 01:17 PM UTC

Thanx for the answer Stanley, but the I don''t seem to get the PasteCellText event. I do get the ClipboardPaste though. regards Fredrik

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

;