webbroser close page

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ilario santamaria

    webbroser close page

    hello

    loading a page in webbroser, try a link and click, you open the pagita everything ok



    Private Sub caricapagina(By Val nomesito As String)
    Try
    WebBrowser1.Nav igate(New Uri(nomesito))

    With WebBrowser1
    Do While .ReadyState <WebBrowserRead yState.Complete
    Application.DoE vents()
    Loop

    CercanelSito (WebBrowser1,"n ome", "titlesito" )


    End With

    Catch ex As System.UriForma tException
    Return
    End Try

    End Sub



    Private sub CercanelSito(By Val WebBrowserName As WebBrowser, byval NameSito as string, byval titlesito as string)


    Dim i As Integer = 0

    For Each Link As HtmlElement In WebBrowserName. Document.Links

    If Link.OuterHtml. Contains(NameSi to) = True Then
    WebBrowserName. Document.Links( i).InvokeMember ("Click")
    Exit For

    End If
    i += 1
    Next


    ''''''' ok open new page

    '''''' problem no close


    'close page '''''''

    Dim isDocumentOpene d As Boolean = True

    Do While isDocumentOpene d


    System.Threadin g.Thread.Sleep( 1000)


    Dim procs As System.Diagnost ics.Process() = System.Diagnost ics.Process.Get ProcessesByName ("IEXPLORE")

    isDocumentOpene d = False
    For Each proc As System.Diagnost ics.Process In procs
    isDocumentOpene d = proc.MainWindow Title.Contains( "titlesito" )

    If isDocumentOpene d Then
    proc.Kill()
    Exit For

    End If

    Next

    Loop

    End Sub

    the problem can not close new page explorer

    if writing code in a button does everything


    Dim procs As System.Diagnost ics.Process() = System.Diagnost ics.Process.Get ProcessesByName ("IEXPLORE")

    For Each proc As System.Diagnost ics.Process In procs

    if proc.MainWindow Title.Contains( "titlesito" ) = true then

    proc.Kill()
    Exit For

    End If

    Next


    thanks
    ilario
  • kimiraikkonen

    #2
    Re: webbroser close page

    On Oct 24, 1:25 pm, ilario santamaria wrote:
    hello
    >
    loading a page in webbroser, try a link and click, you open the pagita everything ok
    >
        Private Sub caricapagina(By Val nomesito As String)
            Try
                WebBrowser1.Nav igate(New Uri(nomesito))
    >
                With WebBrowser1
                    Do While .ReadyState <WebBrowserRead yState.Complete
                        Application.DoE vents()
                    Loop
    >
                    CercanelSito (WebBrowser1,"n ome", "titlesito" )
    >
                End With
    >
            Catch ex As System.UriForma tException
                Return
            End Try
    >
        End Sub
    >
        Private sub CercanelSito(By Val WebBrowserName As WebBrowser, byval NameSito as string, byval titlesito as string)
    >
            Dim i As Integer = 0
    >
            For Each Link As HtmlElement In WebBrowserName. Document.Links
    >
                If Link.OuterHtml. Contains(NameSi to) = True Then
                    WebBrowserName. Document.Links( i).InvokeMember ("Click")
                    Exit For
    >
                End If
                i += 1
            Next
    >
    '''''''   ok open new page
    >
    ''''''  problem no close
    >
         'close page '''''''
    >
            Dim isDocumentOpene d As Boolean = True
    >
            Do While isDocumentOpene d
    >
                System.Threadin g.Thread.Sleep( 1000)
    >
                Dim procs As System.Diagnost ics.Process() = System.Diagnost ics.Process.Get ProcessesByName ("IEXPLORE")
    >
                isDocumentOpene d = False
                For Each proc As System.Diagnost ics.Process In procs
                    isDocumentOpene d = proc.MainWindow Title..Contains ("titlesito" )
    >
                    If isDocumentOpene d Then
                        proc.Kill()
                        Exit For
    >
                    End If
    >
                Next
    >
            Loop
    >
         End Sub
    >
    the problem can not close new page explorer
    >
    if writing code in a button does everything
    >
    Dim procs As System.Diagnost ics.Process() = System.Diagnost ics.Process.Get ProcessesByName ("IEXPLORE")
    >
                            For Each proc As System.Diagnost ics.Process In procs
    >
     if proc.MainWindow Title.Contains( "titlesito" ) = true then
    >
                                       proc.Kill()
                        Exit For
    >
                    End If
    >
                Next
    >
    thanks
    ilario
    You want to kill IE?:

    Try this:

    Imports System.Diagnost ics
    Imports System.Diagnost ics.Process

    For each p As Process In Process.GetProc essesByName("ie xplore")

    p.Kill

    Next

    HTH,

    Onur Güzel

    Comment

    Working...