WebBrowserEx - Unload page method?

richt

Member
Licensed User
Hi there,

First post and new purchaser of Basic4PPC, please forgive me if this question is answered in the WebBrowserEx help but I can't for the life of me open the included .cs file.

I've integrated the WebBrowserEx DLL into my program, using the DocumentText method to create a PayPal payment form, automatically submit the form and then connect to the PayPal site. This works fine.

Once the user has finished I simply close my form, job done.

The problem comes when I want to do another payment and re-open the webbrowser form - the browser is still stuck on the last page since my closing.

Flailing wildly I tried using the dispose method but this seems to get rid of the WebBrowserEX object itself and then you can't create another browser.

I've attached a simple program to demonstrate what I mean, you'll need the Browser.DLL (taken from this link here - http://www.b4x.com/forum/attachments/additional-libraries/3491d1235901910-webbrowserex-browser.zip)

On closing and re-opening the form the webbrowser ignores the DocumentText.

Thanks in advance for any help, loving Basic4PPC (even though I'm using to code cheaply for the desktop!)

Cheers,
Rich
 

Attachments

  • WebBrowserExQuestion.sbp
    976 bytes · Views: 180

agraham

Expert
Licensed User
Longtime User
You are using New1 in the wrong place. An object (normally) only needs to have New1 called on it once. App_Start is the usual place or in an initialisation Sub.

B4X:
Sub App_Start
   webbrowserex.New1("Form2",10,10,350,300)
   Form1.Show
End Sub
What is happening in your case is that the second invocation of New1 places another WebBrowser control on Form2 but lower in the Z-order than the original which still exists so the new one, whose DocumentText you are setting, is not visible.

If you Dispose an object and then want another instance of it you need to add it back with AddObject before Newing it.
 
Last edited:

richt

Member
Licensed User
Ahhhhhhhhhh (slaps forehead)

That's got it, brilliant, thanks for the speedy reply.

:sign0060:
 
Top