By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,156 Members | 1,026 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,156 IT Pros & Developers. It's quick & easy.

Problem creating a ListViewItem object

P: n/a
I am trying to create a form that will display a list of open internet
explorer windows and allow the user to choose one of them. So far I
have created an arraylist which contains all of the open internet
explorer windows. In the for() part of the code below I have tried to
create a listviewitem for each window of internet explorer open (i.e.
each element of the arraylist).

However it's not working. I don't seem to have access to IE's
properties from within the last for loop.
I had hoped that i could use something like the following

ListViewItem ("item" + i) = new ListViewItem(ar[i].LocationURL , 0);

But i cant I dont have access to LocationURL here. I have also tried
the following

ListViewItem ("item" + i) = new ListViewItem(ar[i].ie.LocationURL , 0);

Which also doesn't work. I dont even know if my ("item" +i) is correct,
I had intended for that to create a listview item called itemi, where i
is the index of the arraylist we are currently at.

Can someone please offer advice how I should get this working.



private void Form1_Load(object sender, EventArgs e)
ArrayList ar = new ArrayList();
foreach (InternetExplorer ie in new ShellWindows())
Int32 iLocation = ie.FullName.IndexOf("iexplore");
if (iLocation >= 0) ar.Add(ie);

for (int i = 0; i<ar.Count;i++)

ListViewItem ("item" + i) = new ListViewItem(ar[i] ,
0); *** not working***


Nov 29 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.