Hi everyone
for a DragNDrop File to my destkop application
I let the user choose ( With radio Button ) if is all file to be drop or only JPG
For the jpg it work well…But For the “any” type… it doesn’t show the jpg with the rest of the file
Like jpeg or else… But cant import all together
if RadButJpg.Value = True then
fileSelect = "image/jpeg"
else
fileSelect = "any"
end
I’m not sure what dropFile = fileSelect does though.
Most of the times I accept everything and then handle it internally with If FolderItem.Type = “image/jpeg” etc.
it’s only a loop for a Fill Up listbox
just a list of the drop folder contain
I thought that i’m doing… i’v accept everything to drop
then filter by radio button select, what’s gone be show in my listbox
[quote=242046:@Denis Despres]it’s only a loop for a Fill Up listbox
just a list of the drop folder contain
I thought that i’m doing… i’v accept everything to drop
then filter by radio button select, what’s gone be show in my listbox[/quote]
Since you want to filter the results after the drop, you’re going to need a different approach.
In your RadioButton.Action event you should determine what filter the user wants to apply, and then loop through the ListBox filtering for your results.
This is how I normally do it.
Handle the types you want to accept based on the RB setting inside the FillListBox method.
It probably can be done smarter because the single item drops are handled separately but maybe it helps.
// ListBox.DropObject event
If Obj.FolderItemAvailable Then
Do
FillListBox(obj.FolderItem)
Loop Until Not Obj.NextItem
End If
// FillListBox method
Sub FillListBox(folderItem as FolderItem)
// Add filenames to ListBox
// If it's a Folder, dig through it. If it's a single file, just add it.
If folderItem <> Nil Then
If folderItem.Directory Then
// Folder Drop. Dig through it.
Dim items As Integer = folderItem.Count
For i As Integer = 1 To items
// The item itself can be Nil if symbolic link
If folderItem.TrueItem(i) <> Nil Then
// If Another Directory. Call Self
If folderItem.TrueItem(i).Directory Then
FillListBox(folderItem.TrueItem(i))
Else
// Do filtering of the types here
If(folderItem.TrueItem(i).Type <> "") And (folderItem.TrueItem(i).Name.Left(1) <> ".") Then
Listbox.AddRow("")
Listbox.Cell(Listbox.LastIndex, 0) = folderItem.TrueItem(i).Name
//etc.
End If
End If
End If
Next i
Else
// Single item Drop
// Do filtering of the types here
If(folderItem.Type <> "") And (folderItem.Name.Left(1) <> ".") Then
Listbox.AddRow("")
Listbox.Cell(Listbox.LastIndex, 0) = folderItem.Name
End If
End If
End If
End Sub