473,978 Members | 2,423 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Array of WebBrowser

Greetings,
I need to create a lot of instances of WebBrowsers (let's try 100) and store
that in a WebBrowser[] array according my following code, using Visual
Studio 2005 Beta.

private class Test
{
private WebBrowser[] _browser;

private void OpenBrowser()
{
for(int i=1; i<=100; i++)
{
_browser[i] = new WebBrowser();
_browser[i].Navigate(http://localhost/Tests/WebEvents/main.aspx);
}
}
}

The problem is, when I see how many sessionId was create, I see just 2!
What is the problem of this code?
Please, how can I fix this problem?

Thanks in advance.

zorhel
Nov 16 '05 #1
1 3478
Hi zorhel,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that when you're creating an array of
WebBrowser, the session count only grows by 2. If there is any
misunderstandin g, please feel free to let me know.

Based on my research, there are some mistakes in the code you have provided.

1. A class cannot be declared as private explicitly. Because it is private
by default.
2. The WebBrowser array hasn't been initialized. So if you run the code, a
NullReferenceEx ception will be thrown.
3. The index of an array in C# is zero-based. So the index of the array is
0 to 99.

Here I have made some changes to the code

class Test
{
private WebBrowser[] _browser;

private void OpenBrowser()
{
this._browser = new WebBrowswer[100];
for(int i=0; i<100; i++)
{
_browser[i] = new WebBrowser();
_browser[i].Navigate(http://localhost/Tests/WebEvents/main.aspx);
}
}
}

With this code, we can see session count grows by 10 to 20 on the
performance monitor. This is because IE does cache on the client side, so
not each request is send to the IIS server.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #2

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

Similar topics

5
2109
by: Kruegy Man | last post by:
I have a WinForm application that has a WebBrowser Control. I can navigate to any website fine. I want to store the link addresses in an array to be called back later. For example, if I visit a news website's main page (www.newswebsite.com), they will have links to other stories. The links' address usually appears in the status bar when you mouse over the link (say for example, www.newswebsite.com/story1).
1
18721
by: ducky801 | last post by:
Using VB 2005 express: I am using the webbrowser control to manipulate a website. i need to get the contents of a named table off of one of the pages and put into an array. how can i do this? i have been tinkering with the mshtml.htmltable object but don't quite understand how to use it correctly. how do assign any value to it? do i pass the HTML as a string? (because that doesn't seem to be working). PLEASE HELP ME. I've been...
3
9459
by: TedTrippin | last post by:
Hi, Background - I've create a windows application in VS and added a WebBrowser component and all works well. I'm now trying to do this programmatically. My application now listens on a socket and when it receives a request it creates a new Form and adds a new WebBrowser. The problem - All works well without the WebBrowser, the form is visible, but when I do "Controls.Add(webBrowser)" I see nothing, not even something in the windows...
13
24487
by: dmj07 | last post by:
Hi all, I have a simple table set up in which a user can insert values into the boxes and onkeydown it will sum up the column. Table: <table> <tr> <td><input type="text" onkeydown="calcTotal(this, 'tot')" /></td>
0
10358
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
10175
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11833
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11422
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...
0
10920
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
8465
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
7620
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
6424
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...
3
3773
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.