Hi
use the UltraGrid in the process, if you set a column can not be edited, making the entire line of copy and paste the following tips when the box pops up:
"Error performing Paste operation.Further information:'Cloumn3'cell is read-only.Continue with the remaining cells?"
Q: There are other ways shield the tips? Copy the entire line or shield.
this.ultraGrid1.DisplayLayout.Bands[0].Columns["Column 3"].CellActivation = Activation.NoEdit;
this.ultraGrid1.DisplayLayout.Bands[0].Columns["Column 4"].CellActivation = Activation.NoEdit;
this.ultraGrid1.PerformAction(UltraGridAction.Cut);/ this.ultraGrid1.PerformAction(UltraGridAction.Copy);
this.ultraGrid1.PerformAction(UltraGridAction.Paste);
Thanks.
Using PerformAction for the Cut or Copy options copies entire cells. It will never copy part of a cell or selected text. That's just not what it's for.
If you want to copy selected text from within a cell, then pressing Ctrl+C or Ctrl+X on the keyboard will do that automatically. You don't have to do anything in code for that to work.
My guess is that you are trying to implement a context or popup menu? If that's the case, then you need to check whether the cell is in edit mode or not and take the appropriate action to write what you want to the clipboard.
Noticed that if in edit mode, and select only part of the text, it will still copy entire cell content.
Is there a way to copy only selected text if in edit mode?
You can prevent the prompt from appearing by handling the control's Error event and setting the Cancel property of the event arguments to true. Note that the Error event fires for reasons other than a multi-cell paste error, so you should check the return from the MultiCellOperationErrorInfo property (to make sure is is not null) to determine whether this was the reason the event fired.