Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Controls / December 2006

Tip: Looking for answers? Try searching our database.

Dragging from a listview control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
james - 15 Dec 2006 12:45 GMT
I have a listview control, in detail mode, and I am trying to implement
Drag-and-drop from it.
If I click on an item, I can then re-click and drag it, but if I just click
and drag, it doesn't work, because the item I clicked isn't selected until
the mouse-up event.

I tried turning on "hover selection" on the control, and it works to an
extent, but seems slow to keep up with the mouse, so often you don't then
drag the correct item.

What am I doing wrong? Should I not be accessing the selecteditems
collection for this?
Code snippet:

private void lstExcelHeaders_MouseDown(object sender, MouseEventArgs e)
{
   if (lstExcelHeaders.SelectedItems.Count != 0)
   {
       lstExcelHeaders.DoDragDrop(lstExcelHeaders.SelectedItems[0].Text,
DragDropEffects.All);
   }
}
Jeff Gaines - 15 Dec 2006 13:10 GMT
On 15/12/2006 in message <#mSBibEIHHA.1064@TK2MSFTNGP04.phx.gbl> james
wrote:

>I have a listview control, in detail mode, and I am trying to implement
>Drag-and-drop from it.
[quoted text clipped - 17 lines]
>    }
>}

Can you not use the standard ItemDrag function that is built in to a
ListView?

Signature

Jeff Gaines
Damerham Hampshire UK

james - 15 Dec 2006 15:00 GMT
> On 15/12/2006 in message <#mSBibEIHHA.1064@TK2MSFTNGP04.phx.gbl> james
> wrote:
[quoted text clipped - 6 lines]
> Can you not use the standard ItemDrag function that is built in to a
> ListView?

Ah, that seems better.
Didn't know that was there (serves me right for mindlessly following
examples on the net!)

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.