473,320 Members | 1,823 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,320 software developers and data experts.

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 3449
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
misunderstanding, 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
NullReferenceException 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
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...
1
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? ...
3
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...
13
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"...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.