Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB.NET
|
VB.NET General VB.NET discussions for issues that don't fall into other VB.NET forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 1st, 2005, 12:43 AM
Authorized User
 
Join Date: May 2005
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default Changing Icon during Drag and Drop in treeview

Dear All,
I am working on a Treeview control in VB.NET.
I am able to drag and drop the items from one selected item to another within the treeview control.
But, i also want the icon to change during drag and want to reset it during drop.

I finded that one has to code on the GiveFeedBack event of the control.
I have done that but its not working.
The code for that event is as follows:

Private Sub TreeView3_GiveFeedback(ByVal sender As Object, ByVal e As System.Windows.Forms.GiveFeedbackEventArgs) Handles TreeView3.GiveFeedback

       If e.Effect <> DragDropEffects.None Then
            e.UseDefaultCursors = False
        Else
            e.UseDefaultCursors = True
        End If
End Sub

Can anyone suggest me how to do that.
Pls reply.

Thanks & Regards,
Muskaan.

 
Old October 6th, 2005, 05:14 AM
Authorized User
 
Join Date: May 2005
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi All,
I think no one is bothered to answer my question at this site.
Or anyone does not know the answer.......



 
Old October 10th, 2005, 04:04 AM
Authorized User
 
Join Date: May 2005
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Dear All,
I already implemented the drag and drop functionality and its working fine.
But now i want to change the icon while dragging and reset it again while dropping.

What I have done is used 2 icons--> 1) For Dragging ("drag icon")
                                     2) For Dropping ("drop icon")
And given the path of the files in the following events -> 1) ItemDrag --cursor path file
                                                            2) dragenter --cursor path file
                                                            3) dragover --cursor path file
                                                            4) dragdrop --cursor path file
                                                            5) dragleave --cursor reset

When I run the program, I am able to set "drag icon" while dragging and again setting it o "drop icon" while dropping.
But when I again do the drag and drop, it is only showing the "drop icon" while dragging as well as dropping.
I am coding the following code in GiveFeedBAckEvents :

                If e.Effect = DragDropEffects.Move Then
                    e.UseDefaultCursors = False
                    TreeView3.Cursor = New Cursor("D:\HMIDharmesh\26-09-2005\HMI09092005\bin\18- drop.ico")
                Else
                    e.UseDefaultCursors = True
                    TreeView3.Cursor = Cursors.Arrow
                End If

And at other events like ItemDrag and DragEnter,I am specifying the path of "Drag icon".
At DragLeave, Resetting the cursor.
At DragDrop, resetting the cursor again.

Can anyone tell me what exactly can be the problem??

Thanks & Regards,
Muskaan.


 
Old August 3rd, 2006, 06:16 AM
Registered User
 
Join Date: Jul 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ashutosh_p24
Default

Hi Muskaan

I am facing problems implementing Drag & drop in Vb.NET .Can you share your code.It will be helpfull to me

I am trying to drag from one treeview (source ) to destination treeview...

Thanks in advance
ashutosh





Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing default icon on forms Dunorcaille BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 7 November 4th, 2011 08:35 AM
Drag and Drop batott ASP.NET 2.0 Professional 3 April 26th, 2008 07:59 PM
How to Drag and Drop node from treeview to Datagri mohan_here C# 1 April 26th, 2007 12:41 PM
Drag and drop in treeview lily611 ADO.NET 3 January 15th, 2007 07:49 AM
Drag/Drop bmains Javascript 1 September 22nd, 2004 07:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.