VS 2010 Drag video from windows explorer and drop onto my form to play a video in wmp control-VBForums
Results 1 to 2 of 2

Thread: Drag video from windows explorer and drop onto my form to play a video in wmp control

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2011
    Posts
    29

    Question 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.

  2. #2
    Lively Member
    Join Date
    Aug 2010
    Location
    Look to the right... yep, there i am.
    Posts
    111

    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
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.