PDA

Click to See Complete Forum and Search --> : [RESOLVED] drag and drop question


Crash893
Mar 14th, 2007, 11:41 PM
I am trying to create a drag and drop option for my crystal report viewer


question1

should i be creating the dragdrop event on the from or the viewer or both

question2

for example ill just be useing the viewer


currently im useing

private void crystalReportViewer1_DragOver(object sender, DragEventArgs e)
{
try
{
crystalReportViewer1.ReportSource = e.Data;
}
catch
{
MessageBox.Show("hi");
}
}


but im missing something becuase this isnt even fireing when i drag something over or drag and drop


any suggestions

thanks

Crash893
Mar 15th, 2007, 01:57 AM
I am trying to adapt this code but in my form it doesnt seem to trigger the event

any suggestions


private void listBox1_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
{
// make sure they're actually dropping files (not text or anything else)
if( e.Data.GetDataPresent(DataFormats.FileDrop, false) == true )
// allow them to continue
// (without this, the cursor stays a "NO" symbol
e.Effect = DragDropEffects.All;
}

private void listBox1_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
// transfer the filenames to a string array
// (yes, everything to the left of the "=" can be put in the
// foreach loop in place of "files", but this is easier to understand.)
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);

// loop through the string array, adding each filename to the ListBox
foreach( string file in files )
{
listBox1.Items.Add(file);
}
}

Crash893
Mar 18th, 2007, 01:58 PM
resolved see post http://www.vbforums.com/showthread.php?t=457995