Results 1 to 7 of 7

Thread: How to do it?

Hybrid View

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    6

    Unhappy How to do it?

    hey all
    I need yours help regarding about oledragdrop. I have 1 sstab with 1 tab. The tab got 1 listview. My question is that how to drag the item from listview(within sstab) into a new form that contain listview?
    Very much appreciate for the help.

  2. #2
    PowerPoster
    Join Date
    Aug 2002
    Location
    NY, NY
    Posts
    2,139
    Here is a quik "how to":
    Form1: LIstview1, ImageList1
    Form2: Listview1
    VB Code:
    1. 'Form1
    2. Option Explicit
    3.  
    4. Public ITM As ListItem
    5. Private Sub Form_Load()
    6. Dim i%
    7.  
    8.     For i = 1 To 10
    9.         ListView1.ListItems.Add i, "K" & i, "New Item " & i, "file"
    10.     Next i
    11.     Form2.Show
    12.  
    13. End Sub
    14. Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)
    15.     Set ITM = ListView1.ListItems(ListView1.SelectedItem.Index)
    16. End Sub
    17. Private Sub ListView1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    18.     ListView1.OLEDrag
    19. End Sub
    20.  
    21. 'Form2
    22. Private Sub ListView1_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
    23. '=============================================
    24. Dim i%, k$, t$, ic
    25.  
    26.     i = ListView1.ListItems.Count + 1
    27.     With Form1.ITM
    28.         k = .Key
    29.         t = .Text
    30.         ic = .Icon
    31.     End With
    32.     ListView1.Icons = Form1.ImageList1
    33.     ListView1.ListItems.Add i, k, t, ic
    34.  
    35. End Sub

    Note: code above will "take" item from Listview1 on the Form1 to Form2
    Roy

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    6

    Please help me, gurus!

    hey IROY55
    Thanks for your post. Unfortunately I still unable drag the item to the form2 by using your codes.
    Anyone know how to do it?

  4. #4
    PowerPoster
    Join Date
    Aug 2002
    Location
    NY, NY
    Posts
    2,139
    Check OleDragMode and OleDropMode properties for each control and change them if necessary. I believe it has to be Manual. Otherwise code should work.
    Roy

  5. #5

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    6

    Please help

    Yes, i am sure the oledrag/drop mode set to manual but i failed dragging the item from listview1(form1) into listview2(form2). The dragged item seem only able move inside the listview1.

    please help

  6. #6
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111
    1) read the top post on this forum.

    2) avoid subjects like "how to do it", ask something relative to your question.

  7. #7
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    First, read this: http://www.vbforums.com/showthread.p...hreadid=182707 (as D.E. already said)

    Second, I guess those properties should be set to true.

    Third, there's no need to double-post.
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width