Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
14067 | May 18,2004 01:23 AM UTC | May 18,2004 05:42 AM UTC | WinForms | 1 |
![]() |
Tags: GridControl |
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 if(data.GetDataPresent(DataFormats.Text)) { 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) { this.gridControl1.ChangeCells(this.gridControl1.Selections.Ranges.ActiveRange, rows[0]); 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.
This page will automatically be redirected to the sign-in page in 10 seconds.