Solved

Waiting for a page to load before continuing

Posted on 2006-07-08
7
186 Views
Last Modified: 2010-04-23
I've got an internet explorer opened in one of my forms.  What is the correct way to code, so that it waits until the entire page is completely loaded before continuing on??

0
Comment
Question by:Marc333
  • 5
  • 2
7 Comments
 
LVL 14

Accepted Solution

by:
jjardine earned 500 total points
ID: 17065998
Hey Marc333    please take a look at this post I did a while back regarding ie and waiting for page complete.  
http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21777756.html      

The article address a person wanting to print the page but has to wait for it to load first.  You should be able to do the same thing here.   This uses the Internet Explorer Object.  I am not sure if that is the same as the new webbrowser object in 2005.   What version are you running?
0
 
LVL 3

Author Comment

by:Marc333
ID: 17066059
jjardine,
I'm using an older version, 2002.  I see where it is mentioned to use an addhandler.  I'm still new to .Net, but I'm guessing it looks something like:
AddHandler Explorer.DownloadBegin, AddressOf nameofevent

Is this how you handled it?  What did you use for the Addressof?
0
 
LVL 3

Author Comment

by:Marc333
ID: 17066069
sorry, I meant documentcomplete instead of downloadbegin
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 14

Expert Comment

by:jjardine
ID: 17066269
yes it would be just like you said.   Create a method to call and use AddHandler just like you stated..  That should work.
0
 
LVL 3

Author Comment

by:Marc333
ID: 17066595
jjardine,
I've got one problems though.  It looks like I've got it working fairly well, except once it loads the document, it looks like the handler is firing twice.  Could you take a look and tell me if I'm missing something?

Private Sub Searchbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Searchbtn.Click
        Explorer.Navigate("http://realcomponline.com/asp/search.asp?")
        AddHandler Explorer.DocumentComplete, AddressOf searchload
       
    End Sub

    Public Sub searchload(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent)
        If conn.State <> ConnectionState.Open Then conn.Open()

        Dim dr As DataRow
        Dim str As String = "Select * From MISC where ((ID) = 1);"
        Dim Miscda As New OleDbDataAdapter(str, conn)
        Dim miscds As New DataSet()
        Miscda.Fill(miscds, "Misc")


        Dim vlu As Integer

        SK("+{TAB}", 1)
        SK("{TAB}", 1)
        SendKeys.Send(" ")
        SendKeys.Send("{TAB}")
        SendKeys.Send("05071")

        SendKeys.Send("25")
        SendKeys.Send("{TAB}")
        SendKeys.Send("150")
        SendKeys.Send("{TAB}")

        'SendKeys.Send("~")

    End Sub
0
 
LVL 3

Author Comment

by:Marc333
ID: 17066611
jjardine,
I opened your example in notepad and saw how you were doing the event handler.  Only problem is that I can't use this type of method because I have several events on this form that navigate through several different pages.  And I think this would affect every one of the other events as well (correct me if I missed something)..  Though the addhandler is avoiding this issue.  
0
 
LVL 3

Author Comment

by:Marc333
ID: 17066630
jjardine,
I solved the issue and was able to use your solution by using a variable that I can set for each event.  Thanks for your help.  
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now