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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Count of Cut/Copied Row

Thread ID:

Created:

Updated:

Platform:

Replies:

19756 Oct 4,2004 06:37 AM UTC Oct 4,2004 07:19 AM UTC Windows Forms 1
loading
Tags: GridControl
Ian Mega
Asked On October 4, 2004 06:37 AM UTC

How do I get the number of rows that have been cut/copied? I need to know this when pasting (I''m doing a Paste Insert) so I can insert the correct number of rows first.

Administrator [Syncfusion]
Replied On October 4, 2004 07:19 AM UTC

Here is code that gets the size of the paste in the ClipboardPaste event.
private void gridControl1_ClipboardPaste(object sender, GridCutPasteEventArgs e)
{
	DataObject data = (DataObject) Clipboard.GetDataObject();
	if(data.GetDataPresent(DataFormats.Text))
	{
		string s = (string)data.GetData(DataFormats.Text);
		string[] rows = s.Split(new char[]{''\n''});
		int numRows = rows.GetLength(0);
		if(numRows > 0 && rows[numRows - 1].Length == 0)
			numRows--; //remove extra empty row if present

		int numCols = 0;
		if(numRows > 0)
		{
			string[] cols = rows[0].Split(new char[]{''\t''});
			numCols = cols.GetLength(0);
		}
		Console.WriteLine("{0} rows by {1} cols", numRows, numCols);
	}
}

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

;