Sub DropTarget_DragOver(e As DragEvent)
If IsValidDropEvent(e) Then e.AcceptTransferModes(TransferMode.COPY)
End Sub
Sub IsValidDropEvent(e As DragEvent) As Boolean
If e.GetDragboard.HasFiles Then
Dim files As List = e.GetDragboard.GetFiles
If files.Size = 1 Then
Dim filename As String = files.Get(0)
' Copy and read the file here and check if you accept this file.
' return true if yes, false if not.
Return filename.EndsWith(".txt")
End If
End If
Return False
End Sub