Drag and Drop text on Listbox

Hello,

Does anyone know how to drag a text file into a listbox and she read the text and take the next line (addrow)?

I’ve done the filetype for txt and csv and put me.AcceptFileDrop (FileTypes1.All) in the open event
listbox.

I appreciate any help!

Do this on your

ListBox.DropObject:
if obj.TextAvailable then
me.AddRow(obj.Text)
end if

ListBox.Open:
me.AcceptTextDrop

that’s all

Hello, Horst Jehle

I put your code but nothing happens when I drag the text up the listbox, where I might be going wrong, any ideas?

Are you sure that the event are assigned to the Listbox control? When I make this test project I had the same problem. The Events are assigned to the Window1 and not to Listbox1. This is a problem with the selection of an Element. If is selected and has a grey background, the addevent is relatet to the Window1. If your selected Element has a blue background, than the addevent goes to your element or control.

Obj.text will be empty. Check obj.FolderItem and then get its content via a TextInpuStream.