![]() |
File drag drop on webbrowser control |
Post Reply ![]() |
Author | |
Alina ![]() Newbie ![]() ![]() Joined: 26 September 2008 Location: Romania Status: Offline Points: 4 |
![]() ![]() ![]() ![]() ![]() Posted: 26 September 2008 at 6:20am |
Hello,
I have a form having a web browser control on it. I want to get the file name(s) along with path(s) whenever some file is dragged and dropped on my web browser control.
I added in code Application.RegisterAsDropTarget = True. After that, when a file is draged and dropped on my webbrowser , the webbrowser loads the file's content. And the DragDrop event is not fired.
How can I achieve this functionality? Thanks in advance! |
|
![]() |
|
Lodep59 ![]() Senior Member ![]() ![]() Joined: 03 April 2008 Status: Offline Points: 203 |
![]() ![]() ![]() ![]() ![]() |
Hi, Why don't you use the WB navigate_complete event ? When you drag and drop a file on a WB the file is loaded in the WB (do you want this ?) and the navigate_complete event is fired.
So you can do something like this :
Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
MsgBox "File loaded " & URL End Sub Hope this help.
|
|
![]() |
|
Alina ![]() Newbie ![]() ![]() Joined: 26 September 2008 Location: Romania Status: Offline Points: 4 |
![]() ![]() ![]() ![]() ![]() |
Hi,
Thank you for your reply. It doesn't help me very much ![]() Any other idea? Thanks! |
|
![]() |
|
Lodep59 ![]() Senior Member ![]() ![]() Joined: 03 April 2008 Status: Offline Points: 203 |
![]() ![]() ![]() ![]() ![]() |
If you want you can cancel the navigation !
For this use the before navigate event :
Private Sub WebBrowser1_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
MsgBox "File to upload : " & URL Cancel = True End Sub You should write some conditions to cancel the navigation. If you don't do that your webbrowser will no navigate at all.
|
|
![]() |
|
Alina ![]() Newbie ![]() ![]() Joined: 26 September 2008 Location: Romania Status: Offline Points: 4 |
![]() ![]() ![]() ![]() ![]() |
It was so simple and I didn't see it!
Thank you! |
|
![]() |
|
Lodep59 ![]() Senior Member ![]() ![]() Joined: 03 April 2008 Status: Offline Points: 203 |
![]() ![]() ![]() ![]() ![]() |
You're welcome
![]() |
|
![]() |
|
Pooja ![]() Newbie ![]() Joined: 04 November 2008 Status: Offline Points: 1 |
![]() ![]() ![]() ![]() ![]() |
hello all
I have a from having web browser control on it...
webBroswer control have the url :
this.webBrowser1.Url = new System.Uri("http://localhost:1162/OCOTVWidgetTestPage.html", System.UriKind.Absolute);
But my problem is this that i am unable to drag drop the webBrowser Control..I also make true this property AllowWebBrowserDrop
this .webBrowser1.AllowWebBrowserDrop = true;But still i am unable to do it.. and secondly i m unable to make transperent the back ground og webBrowser Control Please help me what to do.
Thanks in advance
Pooja
|
|
![]() |
|
Lodep59 ![]() Senior Member ![]() ![]() Joined: 03 April 2008 Status: Offline Points: 203 |
![]() ![]() ![]() ![]() ![]() |
Hi,
The background of a webbrowser can't be transparent because it's the background of the webpage.
You want to allow the drag and drop ON the webbrowser or OF the webbrowser ?
It's different, if you want to allow drag and drop of a file on the webbrowser just look at my answer on the top of this post. The drag and drop is controled by the webbrowser control, you don't have to write any code (except for interception).
Note : i'm working with VB6, not you i think...
Hope this help,
|
|
Product: Xtreme SuitePro (ActiveX) last version
Platform: Windows 7 Ultimate Language: VB6 SP6 (FR) |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |