I
ilario santamaria
hello
loading a page in webbroser, try a link and click, you open the pagita everything ok
Private Sub caricapagina(ByVal nomesito As String)
Try
WebBrowser1.Navigate(New Uri(nomesito))
With WebBrowser1
Do While .ReadyState <> WebBrowserReadyState.Complete
Application.DoEvents()
Loop
CercanelSito (WebBrowser1,"nome", "titlesito" )
End With
Catch ex As System.UriFormatException
Return
End Try
End Sub
Private sub CercanelSito(ByVal 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(NameSito) = 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 isDocumentOpened As Boolean = True
Do While isDocumentOpened
System.Threading.Thread.Sleep(1000)
Dim procs As System.Diagnostics.Process() = System.Diagnostics.Process.GetProcessesByName("IEXPLORE")
isDocumentOpened = False
For Each proc As System.Diagnostics.Process In procs
isDocumentOpened = proc.MainWindowTitle.Contains("titlesito")
If isDocumentOpened 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.Diagnostics.Process() = System.Diagnostics.Process.GetProcessesByName("IEXPLORE")
For Each proc As System.Diagnostics.Process In procs
if proc.MainWindowTitle.Contains("titlesito") = true then
proc.Kill()
Exit For
End If
Next
thanks
ilario
loading a page in webbroser, try a link and click, you open the pagita everything ok
Private Sub caricapagina(ByVal nomesito As String)
Try
WebBrowser1.Navigate(New Uri(nomesito))
With WebBrowser1
Do While .ReadyState <> WebBrowserReadyState.Complete
Application.DoEvents()
Loop
CercanelSito (WebBrowser1,"nome", "titlesito" )
End With
Catch ex As System.UriFormatException
Return
End Try
End Sub
Private sub CercanelSito(ByVal 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(NameSito) = 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 isDocumentOpened As Boolean = True
Do While isDocumentOpened
System.Threading.Thread.Sleep(1000)
Dim procs As System.Diagnostics.Process() = System.Diagnostics.Process.GetProcessesByName("IEXPLORE")
isDocumentOpened = False
For Each proc As System.Diagnostics.Process In procs
isDocumentOpened = proc.MainWindowTitle.Contains("titlesito")
If isDocumentOpened 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.Diagnostics.Process() = System.Diagnostics.Process.GetProcessesByName("IEXPLORE")
For Each proc As System.Diagnostics.Process In procs
if proc.MainWindowTitle.Contains("titlesito") = true then
proc.Kill()
Exit For
End If
Next
thanks
ilario