Forms.WebBrowser

  • Thread starter Thread starter Justin
  • Start date Start date
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!
 
Justin

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

Success

Cor
 
?

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.
 
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
 
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!!!!
 
Back
Top