954,517 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Drag and drop

Hello everyone! i need a bit of help... can you convert my picture drag and drop code so it drag and drops audio files? (.wav) My code:


Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()


InitializeComponent()

End Sub

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub


Private components As System.ComponentModel.IContainer


Friend WithEvents pb As System.Windows.Forms.PictureBox
Private Sub InitializeComponent()
Me.pb = New System.Windows.Forms.PictureBox
Me.SuspendLayout()

Me.pb.Dock = System.Windows.Forms.DockStyle.Fill
Me.pb.Location = New System.Drawing.Point(0, 0)
Me.pb.Name = "pb"
Me.pb.Size = New System.Drawing.Size(292, 266)
Me.pb.TabIndex = 0
Me.pb.TabStop = False

Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.Add(Me.pb)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)

End Sub

#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
pb.AllowDrop = True
End Sub

Private Sub pb_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles pb.DragDrop
Try
pb.Image = Image.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 pb_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles pb.DragEnter
If (e.Data.GetDataPresent(DataFormats.FileDrop)) Then
e.Effect = DragDropEffects.Copy
End If
End Sub
End Class

(this code is for drag and dropping pictures)

nv136
Light Poster
30 posts since Aug 2010
Reputation Points: 10
Solved Threads: 0
 

What is wrong with the code from your other thread " Drag and drop "?

codeorder
Posting Virtuoso
1,913 posts since Aug 2010
Reputation Points: 255
Solved Threads: 384
 

after a software update, it stopped working... i still don't know how that happened....
and now that code does not work.....

nv136
Light Poster
30 posts since Aug 2010
Reputation Points: 10
Solved Threads: 0
 

oh wait never mind i fixed it... looks like i might of accidentaly switcher the .net framework to a different version.......... =(

nv136
Light Poster
30 posts since Aug 2010
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: