how to set current image location in

How do I set the current image location in if I use the drag and drop even. It seems like the imagelocation doesn't work because I tried outputting the image location using messagebox. But it didn't show up anything. How do I get the image location of the file that I have just drop into the picturebox so that I could transfer it on another directory?

Private Sub pb_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles pb.DragDrop
            Dim FileToMove As String
            Dim MoveLocation As String
                pb.Image = Image.FromFile(CType(e.Data.GetData(DataFormats.FileDrop), Array).GetValue(0).ToString)

                FileToMove = pb.ImageLocation

                MoveLocation = "C:\pics\" + TextBox1.Text + ".jpg" '"

                If System.IO.File.Exists(FileToMove) = True Then
                    System.IO.File.Move(FileToMove, MoveLocation)

                End If
            Catch ex As Exception
                MessageBox.Show("Error Doing Drag/Drop")
            End Try
        End Sub


Why don't you save e.Data.GetData(DataFormats.FileDrop), Array).GetValue(0).ToString to a variable? That is the file path you are looking for. Not sure why ImageLocation property does not work here.

Need Your Help

bulk insertion in MS SQL from a text file sql-server c#-4.0 insert database

I have a text file that contains around 21 lac entries and I want to insert all these entries into a table. Initially I have created one function in c# that read line by line and insert into table ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.