NEED Help PLS !!! VB.NET- Drag & Dop Problem

Posts 1–13 of 13 · Page 1 of 1
NEED Help PLS !!! VB.NET- Drag & Dop Problem
hey guys
i'm making a listbox with drag and drop event but there is something,i wanna when i drop the file in the list box it opens an open dialog file and automatically choose the file from the path which appears in the listbox when i drop a file in it
i knew hw to open the opendialogfile when i drop it but i don't know how let it automatically get the file from the path which appears in the listbox
and thats the code which i use when drop to open "opendialogfile"
Code:
        Dim s() As String = e.Data.GetData("FileDrop", False)
        Dim i As Integer
        For i = 0 To s.Length - 1
            listBox1.Items.Add(s(i))
        Next i
        openFileDialog1.Filter = "DLL (*.dll) |*.dll"
        openFileDialog1.ShowDialog()
pls answer me QUICKLY
as i think that this need an expert in VB.NET

@Hassan
Code:
Private Sub ListBox1_DragDrop(sender As Object, e As DragEventArgs) Handles ListBox1.DragDrop
        Dim Files As String() = CType(e.Data.GetData(DataFormats.FileDrop), String())
        For Each FileName As String In Files
            ListBox1.Items.Add(FileName)
        Next
    End Sub

    Private Sub ListBox1_DragEnter(sender As Object, e As DragEventArgs) Handles ListBox1.DragEnter
        If e.Data.GetDataPresent(DataFormats.FileDrop) Then
            e.Effect = DragDropEffects.Copy
        End If
    End Sub
Should work. I think
Quote Originally Posted by tetobolla View Post
hey guys
i'm making a listbox with drag and drop event but there is something,i wanna when i drop the file in the list box it opens an open dialog file and automatically choose the file from the path which appears in the listbox when i drop a file in it
i knew hw to open the opendialogfile when i drop it but i don't know how let it automatically get the file from the path which appears in the listbox
and thats the code which i use when drop to open "opendialogfile"
Code:
        Dim s() As String = e.Data.GetData("FileDrop", False)
        Dim i As Integer
        For i = 0 To s.Length - 1
            listBox1.Items.Add(s(i))
        Next i
        openFileDialog1.Filter = "DLL (*.dll) |*.dll"
        openFileDialog1.ShowDialog()
pls answer me QUICKLY
as i think that this need an expert in VB.NET

@Hassan
Quote Originally Posted by DawgiiStylz View Post
Code:
Private Sub ListBox1_DragDrop(sender As Object, e As DragEventArgs) Handles ListBox1.DragDrop
        Dim Files As String() = CType(e.Data.GetData(DataFormats.FileDrop), String())
        For Each FileName As String In Files
            ListBox1.Items.Add(FileName)
        Next
    End Sub

    Private Sub ListBox1_DragEnter(sender As Object, e As DragEventArgs) Handles ListBox1.DragEnter
        If e.Data.GetDataPresent(DataFormats.FileDrop) Then
            e.Effect = DragDropEffects.Copy
        End If
    End Sub
Should work. I think
i already did this..i found it on msdn...i'll explain for u..i'm making an injector for Crossfire and i 've done this Drag and drop thing and it drops alright and show the path of the file in listbox but it doesn't inject the game unless if i used the browse button to open the"openfiledialog" so i want a code thats when i drop the file it opens the "openfiledialog" and choose the file which its path appears in listbox

its a hard thing to do i know but this drag & drop thing will make the injector easier
So, whats the point of the drag and drop when you wanna use the open file dialog?
Quote Originally Posted by DawgiiStylz View Post
So, whats the point of the drag and drop when you wanna use the open file dialog?
the whole form ,because i made a picture with"Drop Here" to make the injector more modern
Why are you trying to make an openfiledialog again?
Quote Originally Posted by tetobolla View Post
the whole form ,because i made a picture with"Drop Here" to make the injector more modern
Quote Originally Posted by DawgiiStylz View Post
Why are you trying to make an openfiledialog again?
because when i drop the hack files in the injector it doesn't inject but when i use the openfiledialog throw Browse Button it injects successfully because it uses the openfiledialog
Then something in your code isn't working right. Is declarations linked in your click even where your drag and drop not doing?
If its not there then the drag and drop is working. I'm guessing it should load the file location (Name, or full name)
Quote Originally Posted by tetobolla View Post
because when i drop the hack files in the injector it doesn't inject but when i use the openfiledialog throw Browse Button it injects successfully because it uses the openfiledialog
Quote Originally Posted by DawgiiStylz View Post
Then something in your code isn't working right. Is declarations linked in your click even where your drag and drop not doing?
If its not there then the drag and drop is working. I'm guessing it should load the file location (Name, or full name)
u mean in the drop code?
Yeah the drop code.

It'll be a little more helpful if I saw your Browse button code and Drop code
Quote Originally Posted by tetobolla View Post
u mean in the drop code?
Private Sub Form1_DragDrop(sender As Object, e As System.Windows.Forms.DragEventArgs) Handles Me.DragDrop


Dim s() As String = e.Data.GetData("FileDrop", False)
Dim i As Integer
For i = 0 To s.Length - 1
listBox1.Items.Add(s(i))
Next i
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.All
Else
e.Effect = DragDropEffects.None
End If
End Sub

this is the drag and drop code and wht do u mean with declarations ??
@DawgiiStylz

---------- Post added at 08:36 PM ---------- Previous post was at 07:57 PM ----------

Quote Originally Posted by DawgiiStylz View Post
Yeah the drop code.

It'll be a little more helpful if I saw your Browse button code and Drop code
thats the Browse Button
Code:
        openFileDialog1.Filter = "DLL (*.dll) |*.dll"
        openFileDialog1.ShowDialog()
and thats the Drop Code
Code:
  Private Sub Form1_DragDrop(sender As Object, e As System.Windows.Forms.DragEventArgs) Handles Me.DragDrop


        Dim s() As String = e.Data.GetData("FileDrop", False)
        Dim i As Integer
        For i = 0 To s.Length - 1
            listBox1.Items.Add(s(i))
        Next i
    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.All
        Else
            e.Effect = DragDropEffects.None
        End If
    End Sub
and thats the OpenFileDialog Code
Code:
 Private Sub openFileDialog1_FileOk(sender As System.Object, e As System.ComponentModel.CancelEventArgs) Handles openFileDialog1.FileOk
        Dim FileName As String = openFileDialog1.FileName.Substring(openFileDialog1.FileName.LastIndexOf("\"))
        Dim DllFileName As String = FileName.Replace("\", "")
        listBox1.Items.Add(DllFileName)
        dlls.Add(DllFileName, openFileDialog1.FileName)
    End Sub
@tetobolla
You would need to run your app as admin to inject into crossfire.
Unless the dll has admin right, drag/drop doesnt work on vista/ win7 unless the file you're dragging has the same rights.
It'l work on win xp though.

Lets say by some off chance it does allow you to drag, you dont need openfiledialog.
You're only injecting the path converted to array into your cave.
If your injector isnt injecting like you say, id look at the code used to get your paths from the listbox.
Im guessing something there is causing the problem.
Quote Originally Posted by Pingo View Post
@tetobolla
You would need to run your app as admin to inject into crossfire.
Unless the dll has admin right, drag/drop doesnt work on vista/ win7 unless the file you're dragging has the same rights.
It'l work on win xp though.

Lets say by some off chance it does allow you to drag, you dont need openfiledialog.
You're only injecting the path converted to array into your cave.
If your injector isnt injecting like you say, id look at the code used to get your paths from the listbox.
Im guessing something there is causing the problem.
can i have ur msn to make it easier?
Posts 1–13 of 13 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?