Results 1 to 5 of 5

Thread: [RESOLVED] What is the diffrence between these two code samples?

  1. #1

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

    Resolved [RESOLVED] What is the diffrence between these two code samples?

    Example given ( works fine)


    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.         }

    And my code for a CrystalReports viewer
    I know the code doesnt do anythine persay but it wont even trigger the event thats what im wondering

    Code:
    1. private void crystalReportViewer1_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.         }

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: What is the diffrence between these two code samples?

    Did you just copy that into the code window or did you create the event handler in the Properties window? If it's the former then there's no connection between the method and the event you're trying to handle. You have to create that connection in the Properties window by either creating a new method or selecting an existing method to handle the event.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

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

    Re: What is the diffrence between these two code samples?

    from the design window i selected the events of the crystal report viewer

    selected Drag enter and double clicked it creating the


    private void crystalReportViewer1_DragEnter(object sender, DragEventArgs e)
    {
    }

    Code

    I then cut and paste the "meat" of the code into that event handler

    and when i drag something over the box i get nothing

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: What is the diffrence between these two code samples?

    Works for me. Did you set the AllowDrop property of the report viewer to true?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

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

    Re: What is the diffrence between these two code samples?

    nope thats probably it

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