Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drag and drop problem

Status
Not open for further replies.

samisammour

Programmer
Aug 7, 2007
7
0
0
SY
I'm trying to do an drag and drop example but it failed.

my code is:

public partial class Form1 : Form
{
[tab]private String f;

[tab]public Form1()
[tab]{
[tab][tab]InitializeComponent();
[tab][tab]f = "D:\\Special";

[tab][tab]String[] files = Directory.GetFiles( f );
[tab][tab]foreach ( String fi in files )
[tab][tab]{
[tab][tab][tab]listView1.Items.Add( fi );
[tab][tab]}
[tab]}

[tab]private void listView1_ItemDrag( object sender, ItemDragEventArgs e )
[tab]{
[tab][tab]DoDragDrop( new DataObject( DataFormats.FileDrop, ( ( ListViewItem ) e.Item ).Text ), DragDropEffects.Copy );
[tab]}
}

The problem is when I drag an item from the listview to any other place it doesn't work, I have searched a lot and I couldn't solve this.
Please help me, it's very urgent.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top