473,396 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

AxWebBrowser create / dispose problem.

On button1 click I create a browser like this:
Dim AxWebBrowser2 As New AxSHDocVw.AxWebBrowser

Then I navigate to url...
AxWebBrowser2.Navigate2(finalurl)

Then dispose it... like this:
Me.AxWebBrowser2.Dispose()

Next time a press button1, it doesn't work...
Gives me an error.

How do I re-create axwebbrowser after disposing it, so it doesn't give
me an error?

Martin

Nov 21 '05 #1
3 2982
MARTIN,

For the webbrowser I always use the toolbox to get all dependencies from
that and drag it to a form and don't make it to small.

And than I don't dispose it. It has cost me to much time to succeed in that.

In addition, I have seen in this newsgroup, that I am not the only one for
that.

It is not for nothing that the behaviour will very much upgraded in the next
version.

I hope this helps?

Cor
Nov 21 '05 #2
Hi Martin

What error? On which line?

Charles
"MARTIN LANNY" <ma**********@gmail.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
On button1 click I create a browser like this:
Dim AxWebBrowser2 As New AxSHDocVw.AxWebBrowser

Then I navigate to url...
AxWebBrowser2.Navigate2(finalurl)

Then dispose it... like this:
Me.AxWebBrowser2.Dispose()

Next time a press button1, it doesn't work...
Gives me an error.

How do I re-create axwebbrowser after disposing it, so it doesn't give
me an error?

Martin

Nov 21 '05 #3
This problem was all because no one could get axwebbrowser to refresh
properly.
I found this function:

Public Function GetPageHTML(ByVal URL As String, Optional ByVal
TimeoutSeconds As Integer = 10) As String
' Retrieves the HTML from the specified URL,
' using a default timeout of 10 seconds
Dim objRequest As Net.WebRequest
Dim objResponse As Net.WebResponse
Dim objStreamReceive As System.IO.Stream
Dim objEncoding As System.Text.Encoding
Dim objStreamRead As System.IO.StreamReader

Try
' Setup our Web request
objRequest = Net.WebRequest.Create(URL)
objRequest.Timeout = TimeoutSeconds * 1000
' Retrieve data from request
objResponse = objRequest.GetResponse
objStreamReceive = objResponse.GetResponseStream
objEncoding = System.Text.Encoding.GetEncoding( _
"utf-8")
objStreamRead = New System.IO.StreamReader( _
objStreamReceive, objEncoding)
' Set function return value
GetPageHTML = objStreamRead.ReadToEnd()
' Check if available, then close response
If Not objResponse Is Nothing Then
objResponse.Close()
End If
Catch
' Error occured grabbing data, simply return nothing
Return ""
End Try
End Function

To grab html code from the page and it is always a new and refreshed
page.
So this solved my troubles and because I do not have to use
axwebbrowser anymore, my application went down in size by 7 mb.
Amazing ...
Anyway, thanks for trying to help me.

Martin

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Martin Ho | last post by:
Hey Everyone, I really hope there is someone who can figure out this problem. Honestly, I spent 3 days now trying to find the solution, but nothing works. I'll try to explain the problem...
1
by: antoine Veret | last post by:
Hi, is there changes on axWebBrowser with framework 1.1 ? events doesn't fire for this object. and an other question; how release memory for axWebBrowser object ? when i create those objects,...
0
by: Matthias Kwiedor | last post by:
I have a aplication which hosts an axWebbrowser. This activex component needs about 10 to 15 mb of memory. Because i have a option to move the aplication to tray icon and do some timer work i...
1
by: SPG | last post by:
Hi, I have an app that requires several of the web controls to be shown in an MDI form. In most cases I can show these forms and point them all to different URLS fine. Every now and then,...
1
by: Mantorok | last post by:
Hi Is there anyway to get a WebBrowser to work without placing it on a form. I want to be able to instantiate a browser, complete some of the fields and submit, but whenever I try to navigate...
6
by: MARTIN LANNY | last post by:
Is there alternative to AxWebBrowser? I spent one whole week trying to make AxWebBrowser refresh php page. It never works. I tried over 10-15 suggestions from Microsoft itself. Refresh just...
0
by: sagar.jawale | last post by:
Hi, In my c# windows application, i am using AxSHDocVw.AxWebBrowser. I am displaying a generated receipt html in this browser. Also, for printing the same html, i am using the following command...
0
by: Ben | last post by:
Hi all, I am trying to write a little app that will generate a thumbnail image of a website. Having searched the web I have found various bits of code that appear to do the job and have written...
1
by: tim2006 | last post by:
When i try to run the program, it just hangs. If i remove the axwebbrowser control it works fine. Any ideas? Here is my code: class1.vb Imports System.Windows.Forms Imports...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.