|
-
Nov 1st, 2000, 10:42 AM
#1
Thread Starter
Lively Member
i have 2 listbox how could i make program that when i drag and drop item from desktop list1 get the file name and list2 get complet location (ex:"c:\Program files\Internet Explorer\Iexplore.exe"). Does any one know how to do this please help me.
Thank you
-
Nov 1st, 2000, 10:53 AM
#2
transcendental analytic
Code:
Private Sub Form_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Data.GetFormat(15) Then
For n = 1 To Data.Files.Count
List1.AddItem Filepart(Data.Files(n))
List2.AddItem Data.Files(n)
Next n
Else
End If
End Sub
private Function Filepart(filepath)
For n = Len(filepath) To 1 Step -1
If Mid(filepath, n, 1) = "\" Then Exit For
Next n
Filepart = Mid(filepath, n + 1)
End Function
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 1st, 2000, 11:03 AM
#3
New Member
Hi, Kedaman,
If you look in the tips section, tip #66 shows how to drag and drop into list boxes.
http://www.vb-world.com/tips/tip66.html
 File not found!
Abort, Retry, Get a Beer...
L8r
-
Nov 1st, 2000, 11:09 AM
#4
Frenzied Member
hmm.. Kedaman's code is less complicated and works great! (i use it too!)
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Nov 1st, 2000, 11:21 AM
#5
transcendental analytic
the Tip, could be useful too, (thanks Nemo) if you have controls without OLEDragDrop events
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 1st, 2000, 11:31 AM
#6
_______
<?>
Code:
Option Explicit
'Here 's one way that you can let users drag items from one list
'and drop them in another one.
'Create two lists (list1, list2)and a text box (text1)
Private Sub Form_Load()
' Set the visible property of text1 to false
Text1.Visible = False
'Add items to list1
List1.AddItem "This"
List1.AddItem "Example"
List1.AddItem "Comes To You"
List1.AddItem "Compliments of someone and me."
List1.AddItem "somewhere on planet earth"
List1.AddItem "Enjoy!"
'
End Sub
'In the mouseDown event of the list list1 put the following code:
Private Sub list1_MouseDown(Button As Integer, _
Shift As Integer, X As Single, y As Single)
Dim z As Integer
z = List1.ListIndex
'do the drag
Text1.Text = List1.Text
Text1.Top = y + List1.Top
Text1.Left = X + List1.Left
Text1.Drag
'remove item from list1 and refresh listcount
List1.RemoveItem (z)
List1.Refresh
'if empty disable the box as it will result in error's on empty
If List1.ListCount = 0 Then
List1.Enabled = False
End If
'
End Sub
'In the dragDrop event of the list list2 put the following code:
Private Sub list2_DragDrop(Source As Control, X As Single, y As Single) '
List2.AddItem Text1.Text
End Sub
'Now you can drag items from list1 and drop them in list2.
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Nov 1st, 2000, 12:47 PM
#7
Thread Starter
Lively Member
Re: <?>
i put the code you give me above Form_OLEDragDrop but and i have 2 listbox but it's not working for me if you know why help me.
-
Nov 1st, 2000, 01:01 PM
#8
transcendental analytic
forgot one thing, set the form Ole_dropmode property to 1-Manual Should work fine.
BTW, HeSaidJoe, one thing i've been thinking about many times, why you put <?> in the post subjects?
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 1st, 2000, 01:07 PM
#9
_______
<?>
kedeman...
the matter of the subject is the question
ie: subject = ? 'cept it's in brackets.
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|