473,396 Members | 2,037 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.

webbroser close page

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("Cli ck")
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("IEX PLORE")

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("IEX PLORE")

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
Oct 24 '08 #1
1 1750
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(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("Cli ck")
* * * * * * * * 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("IEX PLORE")

* * * * * * 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("IEX PLORE")

* * * * * * * * * * * * 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
You want to kill IE?:

Try this:

Imports System.Diagnostics
Imports System.Diagnostics.Process

For each p As Process In Process.GetProcessesByName("iexplore")

p.Kill

Next

HTH,

Onur Güzel
Oct 24 '08 #2

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

Similar topics

2
by: Thang Nguyen | last post by:
Hi, my page contains an applet. When I click on a link on the page, the applet will be launched.Now I need my page can be automatically closed when I close my applet.I can call the script from my...
28
by: PerryC | last post by:
Anyone know how to auto close the parent / opener window without confirmation? I have tried: <script> opener.window.close() </script> ----I put it in the child html page, and nothing...
4
by: GrantS | last post by:
I am having a problem closing a popup window opened modally. When I try to close the window (when the user hits save button and the data has been processed), the Popup window opens as a full screen...
6
by: No_Excuses | last post by:
All, I am interested in reading the text of a web page and parsing it. After searching on this newgroup I decided to use the following: ******************************* START OF CODE...
5
by: Randy | last post by:
Hi, in C# I'm able to access a webbrowser control with the following code and print out all "tags": IHTMLDocument2 HTMLDocument = (IHTMLDocument2)browser.Document; IHTMLElementCollection...
1
by: Bob | last post by:
Is this a good way to close DB Connection in ASP.NET? I've been trying to come up a way to close DB connection automatically (or sort of) in my ASP.NET application without having to write the...
4
by: louise raisbeck | last post by:
I have this scenario (simplified) function addnewdata () { check for partial match already in db for information entered by user if (partialmatch succeeds) { open new window aspx page (using...
1
by: nebulus | last post by:
I'm working on a web app that under normal circumstances will be happy with the Session_OnEnd event, but when a user leaves a page by closing the browser by either Alt+F4 or just hitting the "X",...
5
by: jimmy | last post by:
Hi all, I want to capture the event when the browser's close button is clicked in an html page. I tried using the event.ClientX and event.ClientY property in the body unload event, and this...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.