473,657 Members | 2,550 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Oct 24 '08 #1
1 1765
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
Oct 24 '08 #2

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

Similar topics

2
7635
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 applet to do this, but the poor thing is each time the script is called, IE will prompt to ask "the page you are viewing try to close the window ..". Is there any possible way for the browser not to prompt like that. I only know that a closing a...
28
14244
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 happen!!---
4
34862
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 as a new window. The original window plus the Modally opened Pop remain in a separate window. What I want to do is close the popup and return to the original window with its view state maintained. The control use to fire the popup window...
6
4591
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 ************************ String sTemp = "http://cgi3.igl.net/cgi-bin/ladder/teamsql/team_view.cgi?ladd=teamknights&num=238&showall=1"; WebRequest myWebRequest = WebRequest.Create(sTemp); WebResponse myWebResponse = myWebRequest.GetResponse();
5
18378
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 links = HTMLDocument.links;
1
1463
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 close() method everywhere. Every web page in my application needs to call the database, and all DB access and SQL Command code are wrapped in a separate class (called DBAccess below). I don't want to open and close the connection within every...
4
1914
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 javascript) with a datagrid of these partial match records (by doing a sqlcommand using some query string values taken from opener data entered) *** }
1
33144
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", I'll need to kill the session. Now, with the onbeforeunload event, I can handle this quite easily in IE, but in FireFox, it's another matter. For one thing, FireFox seems to empty out its event object on a page unload, so it's very hard to track...
5
34361
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 helps to recognise whether the close button is clicked( also differentiates whethet refresh was clicked). The problem arises whenever i try to close the window by resizing it or by right clicking at the bottom of the page and then closing it. Can...
0
8425
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8743
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8522
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8622
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6177
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5647
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2745
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1736
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.