Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
That darn Clipboard
Message
General information
Forum:
ASP.NET
Category:
Other
Title:
That darn Clipboard
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01134782
Message ID:
01134782
Views:
63
I am having some issues with my clipboard. The following code is almost a straight copy from the docs.
Clipboard.SetData("Class1Format", new Class1("42"));
if (Clipboard.ContainsData("Class1Format"))
{
	Class1 o = Clipboard.GetData("Class1Format") as Class1;
	// is is null here so the line below will throw an exception
	MessageBox.Show(o.MyMethod());
}
else
{
	MessageBox.Show("Ain't nothing there!!");
}
I think the instance of Class1 is placed in the clipboard successfully but there are some issues retreiving it. I have also tried the "old" way:
Clipboard.SetDataObject(new Class1("42"));
Class1 o = Clipboard.GetDataObject() as Class1;
// o is null!!
MessageBox.Show(o.MyMethod());
I got a feeling is is something very simple that I am missing.

TIA,
Einar
Semper ubi sub ubi.
Next
Reply
Map
View

Click here to load this message in the networking platform