[RESOLVED] drag and drop question
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
Code:
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
Re: drag and drop question
I am trying to adapt this code but in my form it doesnt seem to trigger the event
any suggestions
vb Code:
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);
}
}
Re: drag and drop question