Results 1 to 4 of 4

Thread: Drag And Drop music/video files

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2011
    Posts
    57

    Drag And Drop music/video files

    Hello forumers ! How are you all ??

    First of all, happy new 2012 !

    And continuing...

    I have a doubt. I'd like to make a program where you can drag music files (mp3, flac, wav, wma..) and video files (avi, mpeg, mp4, vob, mov) and get the property values of this ones...
    For example, bitrate, KBps, size, etc, to put them in textbox or listboxes.

    If you can teach me how, or give me any references or something, woulr be great !!

    Thanks : D !

  2. #2
    Frenzied Member
    Join Date
    May 2003
    Location
    Sydney
    Posts
    1,123

    Re: Drag And Drop music/video files

    Happy New Year to you too.

    Here is the first part - drag files into your program: http://msdn.microsoft.com/en-us/library/ms973845.aspx

  3. #3
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: Drag And Drop music/video files

    here's some help with the 2nd part:

    http://www.vbforums.com/showthread.php?t=652359

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: Drag And Drop music/video files

    here's some more help with the dragdrop part:

    vb Code:
    1. Public Class Form1
    2.  
    3.     Private Sub Form1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Me.DragDrop
    4.         If e.Data.GetDataPresent(DataFormats.FileDrop) Then
    5.             Dim droppedFiles() As String = DirectCast(e.Data.GetData(DataFormats.FileDrop), String())
    6.             Dim extensions() As String = {".mp3", ".flac", ".wav", ".wma", ".avi", ".mpeg", ".mp4", ".vob", ".mov"}
    7.             Dim acceptedFiles() As String = droppedFiles.Where(Function(s1) extensions.Any(Function(s2) s2 = IO.Path.GetExtension(s1))).ToArray
    8.             MsgBox(String.Join(Environment.NewLine, acceptedFiles))
    9.         End If
    10.     End Sub
    11.  
    12.     Private Sub Form1_DragOver(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Me.DragOver
    13.         If e.Data.GetDataPresent(DataFormats.FileDrop) Then
    14.             e.Effect = DragDropEffects.Copy
    15.         Else
    16.             e.Effect = DragDropEffects.None
    17.         End If
    18.     End Sub
    19.  
    20.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    21.         Me.AllowDrop = True
    22.     End Sub
    23.  
    24. End Class

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width