Forms.WebBrowser

J

Justin

I can't seem to get a handle on the drag/drop operation for the web browser
control.

I'm trying to drag links to a textbox and drop the link URL into the
textbox.

Can anyone point me in the right direction?

VB.NET 2008

Thanks!
 
C

Cor Ligthert[MVP]

Justin

You should simply set a separate textbox on a form when you use a webbrowser

Success

Cor
 
J

Justin

?

On my form I have many textboxes and a web browser control. I turned on the
drag/drop properties but I can't get it to work.
 
R

roidy

1. Create a form with a web browser control and a textbox
2. For the textbox set AllowDrop to true
3. Add a DragEnter and a DragDrop event handler to the textbox.
4. For the DragEnter event add the following code:-

If (e.Data.GetDataPresent(DataFormats.Text)) Then
e.Effect = DragDropEffects.Link
End If

5. For the DragDrop event add the following code:-

TextBox1.Text = e.Data.GetData(DataFormats.Text)

6. Run program and try dragging a link into the textbox

Hope that helps
Rob
 
J

Justin

Awesome! Thanks so much! This is exactly what I needed. As always, now
that I see, DUH, makes perfect sense.

Just one tiny little update for anyone that happens by and also needs it for
multiple text boxes:


DragDrop:

Dim senderBox As TextBox = DirectCast(sender, TextBox)
sender.Text = e.Data.GetData(DataFormats.Text)

Thanks again!!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top