I am new to C# and the UltraGrid.
I want to add a WinForm Copy button that will paste all highlighted grid rows into the current Ultragrid as new rows (I have an identity field column, so, dupes will not be an issue.)
I guess I am just not 'getting' it yet as googling and help searching has not helped. I would have thought this would be such a simple, built in feature that would be easy to find and implement???
2 QUESTIONS:
1) Does anyone have the C# button code that will copy the highlighted grid row(s) and paste into the same grid?
2) Does anyone have the code (or settings) to do the same copy in a Ctlr/C Ctrl/V copy ppaste in the grid?
Watson,You can refer the following help article from Infragistics:http://help.infragistics.com/Help/NetAdvantage/WinForms/2009.1/CLR2.0/html%5CWinGrid_Creating_an_Edit_Menu_with_Clipboard_Operations_for_WinGrid.htmland following code will help you to copy and paste the grid data: private void btnCopy_Click(object sender, System.EventArgs e) { this.UltraGrid1.PerformAction(UltraGridAction.Copy); } private void btnPaste_Click(object sender, System.EventArgs e) { this.UltraGrid1.PerformAction(UltraGridAction.Paste); }Thank you.Bunty :)
Hi,
Bunty_Mishra's suggestion, the ultraGrid.PerformAction(UltraGridAction.Copy) works for me.However, I would also like to determine, if the clipboard has the data of copied rows on it, because I'm enabling/disabling some controls on this condition.
I'm trying to use Clipboard.ContainsData(DataFormat d), which requires the DataFormat to be specified. Can you tell me, which DataFormat I can use for this? Or is there a better way, to achieve this?
Thanks,Richard
I am having the same problem. I am already using "ultraGridAnalyzer.PerformAction(UltraGridAction.Copy);" which he probably was too, but it just does not work. It does not add anything to my clipboard. I can step though the code and it is being executed.
Can anyone help?