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.

Count of Cut/Copied Row

Thread ID:





19756 Oct 4,2004 02:37 AM Oct 4,2004 03:19 AM Windows Forms 1
Tags: GridControl
Ian Mega
Asked On October 4, 2004 02:37 AM

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 03:19 AM

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();
		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);


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.

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.