Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
130
How to get Droptarget info.
posted

Hello,

I was wondering if anyone knew how to get a DropTarget's info.  Say I have multiple textboxes and when I drop data into one of them, I would like to be able to get the name of the textbox that I dropped data into.

I was playing around with e.DropTargets.ToString(); 

But didn't really get anything out of it.

Thanks for any help,

Kiet

 

  • 8831
    posted

    Hello Kiet,

    I think you need to access the DragDropEventArgs.DropTarget property.

    Best regards.
    Plamen.

  • 399
    posted

    Hi Kiet,

    Please convert the type of the object.
    I think that the Drop event becomes such mounting.

                TextBox textBox = e.DropTargets as TextBox;
               
                if (textBox != null)
                {
                    switch (textBox.Name)
                    {
                        case "TextBox Name1":
                            //implementation individual drop processing
                            break;
                        case "TextBox Name2":
                            //implementation individual drop processing
                            break;
                        case "TextBox Name3":
                            //implementation individual drop processing
                            break;
                    }
                }

    Regards.