Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / September 2004

Tip: Looking for answers? Try searching our database.

GetDataPresent and interfaces (DragDrop)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chetan Mistry - 17 Sep 2004 23:48 GMT
Is is possible to check to see during a drag drop operation if the
object being dropped implements a particular interface?

For example, if I have the following class which implements
IMyInterface:

class MyClass : IMyInterface
{
 // implementation ommitted
}

Then when I start dragging I call DoDragDrop() like this:

MyClass myClass = new myClass();
IMyInterface myInterface = myClass as IMyInterface;
DoDragDrop( myInterface, DragDropEffects.Copy );

Then when I get my DragEnter event I want to check if the data
supplied implements IMyInterface. e.g.

if ( e.Data.GetDataPresent( typeof (IMyInterface) ) .....

This returns false but if a do "typeof(MyClass) it works fine.

How can I check to see if the item being dropped implements a specific
interface?

Thanks.
Chet
Matt Berther - 18 Sep 2004 20:06 GMT
Hello Chetan,

The is keyword...

if (myVar is IMyInterface)
{
// do something
}

--
Matt Berther
http://www.mattberther.com

> Is is possible to check to see during a drag drop operation if the
> object being dropped implements a particular interface?
[quoted text clipped - 23 lines]
> Thanks.
> Chet

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.