Results 1 to 3 of 3

Thread: [RESOLVED] drag and drop question

  1. #1

    Thread Starter
    Fanatic Member Crash893's Avatar
    Join Date
    Dec 2005
    Posts
    930

    Resolved [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

  2. #2

    Thread Starter
    Fanatic Member Crash893's Avatar
    Join Date
    Dec 2005
    Posts
    930

    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:
    1. private void listBox1_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
    2.         {
    3.             // make sure they're actually dropping files (not text or anything else)
    4.             if( e.Data.GetDataPresent(DataFormats.FileDrop, false) == true )
    5.                 // allow them to continue
    6.                 // (without this, the cursor stays a "NO" symbol
    7.                 e.Effect = DragDropEffects.All;
    8.         }
    9.  
    10.         private void listBox1_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
    11.         {
    12.             // transfer the filenames to a string array
    13.             // (yes, everything to the left of the "=" can be put in the
    14.             // foreach loop in place of "files", but this is easier to understand.)
    15.             string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
    16.  
    17.             // loop through the string array, adding each filename to the ListBox
    18.             foreach( string file in files )
    19.             {
    20.                 listBox1.Items.Add(file);
    21.             }
    22.         }

  3. #3

    Thread Starter
    Fanatic Member Crash893's Avatar
    Join Date
    Dec 2005
    Posts
    930

    Re: drag and drop question


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width