CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2000
    Posts
    48

    Drag & Drop on DataGrid Not Working

    I have AllowDragDrop set to TRUE on DataGrid1 and DataGrid2.

    Here is my code..

    private void dataGrid1_DragLeave(object sender, System.EventArgs e)
    {
    string strText = "Testing";
    dataGrid1.DoDragDrop(strText, DragDropEffects.Copy) ;
    }

    private void dataGrid2_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
    {
    string strText = e.Data.GetData(DataFormats.Text).ToString();
    MessageBox.Show(strText);
    }


    I'm trying to do a grad test to pass the word "Testing". When I drag an item from datagrid1 to datagrid2, nothing happens. Any idea what is going on?

    Thank you!
    - Adrian

  2. #2
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    AMON,
    when you drag text does it comes in
    dataGrid2_DragDrop method atleast.


    -Paresh
    - Software Architect

  3. #3
    Join Date
    Aug 2000
    Posts
    48
    Hi Pareshgh,

    No, not even the dataGrid2_DragDrop method. There are no visible signs on dataGrid1 or dataGrid2 that drag and drop is working.

    I also tried changing the ReadOnly attribute on the dataGrids, but the same happens.

    Any suggestions?

    Thanks you,
    - Adrian

  4. #4
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    Hi,
    I have attached the source code project for Datagrid Text drag and drop.

    you can have a look and check it out.

    hope this helps

    Paresh
    Attached Files Attached Files
    - Software Architect

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

Featured