|
-
Dec 14th, 2011, 10:40 PM
#1
Thread Starter
Junior Member
Drag video from windows explorer and drop onto my form to play a video in wmp control
Hi, I have some code that i got from another post on vb forums but i don't know how to intemperate it to work with my program this is what i have and have changed so far.
Code:
Private Sub Form1_DragDrop(sender As Object, e As System.Windows.Forms.DragEventArgs) Handles Me.DragDrop
Me.AllowDrop = True
Try
AxWindowsMediaPlayer1.URL = FromFile(CType(e.Data.GetData(DataFormats.FileDrop), Array).GetValue(0).ToString)
Catch ex As Exception
MessageBox.Show("Error Doing Drag/Drop")
End Try
End Sub
'---------------------
Private Sub Form1_DragEnter(sender As Object, e As System.Windows.Forms.DragEventArgs) Handles Me.DragEnter
If (e.Data.GetDataPresent(DataFormats.FileDrop)) Then
e.Effect = DragDropEffects.Copy
End If
End Sub
This is the link to the original - http://www.vbforums.com/showthread.php?t=328593
what i want it to do is you drag any video from windows explorer/ desktop onto form1 and the video gets loaded into theaxwindowsmediaplayer1 control's url
Thank you.
-
Dec 15th, 2011, 12:05 AM
#2
Lively Member
Re: Drag video from windows explorer and drop onto my form to play a video in wmp con
make sure form1 has DragDrop enabled, because 'Me.AllowDrop' isn't being fired until 'DragDrop' gets initialized, which won't ever initialize unless you tell the form to allow it.
If this isn't the error, then what is? is there an exception?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|