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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to implement a Fill Paste in the grid

Thread ID:





14067 May 18,2004 01:23 AM UTC May 18,2004 05:42 AM UTC WinForms 1
Tags: GridControl
Administrator [Syncfusion]
Asked On May 18, 2004 01:23 AM UTC

Hi, I''m trying to do a ''fill paste'' - ie if you copy a single cell, and then paste into a multiple cell selection, each cell gets the value pasted. Do you have any suggestions how I might go about implementing this? Thanks, Sue

Administrator [Syncfusion]
Replied On May 18, 2004 05:42 AM UTC

You can try handling this in the ClipboardPaste event.
private void gridControl1_ClipboardPaste(object sender, GridCutPasteEventArgs e)
	DataObject data = (DataObject)Clipboard.GetDataObject();
	string[] rows = null;
	int numRows = 0;
	int numCols = 0;
	//get the size of the paste
		string s = (string)data.GetData(DataFormats.Text);
		rows = s.Split(new char[]{''\n''});
		numRows = rows.GetLength(0);
		if(numRows > 0 && rows[numRows - 1].Length == 0)
			numRows--; //remove extra empty row if present
		if(numRows > 0)
			string[] cols = rows[0].Split(new char[]{''\t''});
			numCols = cols.GetLength(0);

	//paste one to many
	if(numRows == 1 && numCols == 1 && !this.gridControl1.Selections.Ranges.ActiveRange.IsEmpty)
		e.Handled = true;
		e.Result = true;


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon