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

Copied Contents

Hai , I am using GDBD and have a context menu attached to it,which has the properties of Copu and Paste. The code I am using for coping is: this.gridDataBoundGrid1.Model.CutPaste.Copy(); Bofore copying the contents to another cell I want to check the contents of wht are copied and the do the paste .the code I am using is : this.gridDataBoundGrid1.Model.CutPaste.Paste();

3 Replies

AD Administrator Syncfusion Team August 27, 2004 08:53 AM UTC

Is your question, How do I get the information on the clipboard? If so, try
DataObject data = (DataObject) Clipboard.GetDataObject();
if(data.GetDataPresent(DataFormats.Text))
{
	string s = (string)data.GetData(DataFormats.Text);
        //s holds the string on the clipboard
}


AR arvind August 27, 2004 09:16 AM UTC

Hai , I want to check if the copied value is integer or not .That is basically my requirement >Is your question, How do I get the information on the clipboard? > >If so, try >
>DataObject data = (DataObject) Clipboard.GetDataObject();
>if(data.GetDataPresent(DataFormats.Text))
>{
>	string s = (string)data.GetData(DataFormats.Text);
>        //s holds the string on the clipboard
>}
>


AD Administrator Syncfusion Team August 27, 2004 10:25 AM UTC

In the code above, check if the string s holds an integer in some way. You could loop through the characters in s checking each character, or use int.Parse in a try-catch block, or you could use double.TryParse. double d; if(double.TryParse(s, System.Globalization.NumberStyles.Integer, null, out d) { // s holds an integer and d is the value }

Loader.
Up arrow icon