This question is close to what interests me, but not quite.
I have a .NET WinForms application written in C #. I have a ListView control that displays an array of C # objects. I hooked it up so that you can drag these list items into another form in one application and correctly pass an array of objects ( Session type) to the drop handler for that other form.
However, now I want to support drag and drop when I run multiple instances of my application. It seems that it will work (for example, GetDataPresent successfully), but it ultimately throws an exception when I really try to get the data - it cannot drop object[] in Session[] .
if (e.Data.GetDataPresent("Fiddler.Session[]")) { Session[] oDroppedSessions; try { oDroppedSessions = (Session[])e.Data.GetData("Fiddler.Session[]"); } catch (Exception eX) {
Does anyone know if I should implement ISerializable for my objects to make this work? Usually Iβm just trying to do this, but an ISerializable implementation for this class would be completely non-trivial, and I worry that these might be strange side effects.
UPDATE : the implementation of ISerializable does not help - the method is never called. Similarly, adding a Serializable attribute to a class has no effect. Any other ideas?
c # winforms drag-and-drop
EricLaw
source share