Link to home
Start Free TrialLog in
Avatar of Figle
Figle

asked on

Listbox troubles in Visual C#

I am currently making a ajax enabled asp.net 2.0 C# web page using Visual studio.net 2005  that pings 13 servers at timed intervals.

I am wondering:
1. If and how i can use the below mentioned variable svr in the below mentioned loop to be passed as the hostname to ping the various servers as it loops though on page load.

2. If and how i can include a image inside a listbox a part of the loop in the below code snippet  

It errors on PingReply reply = pingSender.Send(hostName, timeout, buffer, options); saying no host exists so it must not be being passed.


protected void Page_Load(object sender, EventArgs e)
    {
        string[] servers = File.ReadAllLines(Server.MapPath("TestFile.txt"));
        foreach (string svr in servers)
        {
          ListBox1.Items.Add(svr + " is Online");
        }
} 
 
And my ping code is

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Marcus Keustermans
Marcus Keustermans
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial