473,785 Members | 2,374 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem creating a ListViewItem object

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.

Thankyou.

Gary.


private void Form1_Load(obje ct sender, EventArgs e)
{
ArrayList ar = new ArrayList();
foreach (InternetExplor er ie in new ShellWindows())
{
Int32 iLocation = ie.FullName.Ind exOf("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
0 1603

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

Similar topics

2
2032
by: Piotr Szukalski | last post by:
Hi! I have trouble with 'Contains' method in ListViewItemCollection class - it seems like it nevers calls 'Equals' method of class inherited from ListViewItem... I've found that ListViewItem doesn't override 'Equals' method, but I _DO_ override it in my class. Have a look at thread:...
5
5223
by: Richard Muller | last post by:
Hi All, As I recall from Java Swing, I could assign the widths of columns to something like a list control proportionally rather than absolutely. That is, essentially I could assign "weights" x, y and z to the columns respectively of a three-column list control; at run time, the system would calculate the available space for the control and, given that w was determined to be the absolute width of the control, would assign w*x /...
2
1637
by: Max Adams | last post by:
Question about using delegates with a string paramater to return a ListViewItem object... All, I have a thread and I want this thread to post messages to the main GUI thread using a delegate. This is my code fragment: ListViewItem lview = m_form.Invoke( m_form.m_DelegateAddItem, new object {"hello"} );
4
3144
by: sonu | last post by:
Hi, I have a problem regarding use of a ListviewSorter class which is used to sort the items in the listview. Basically I have a listview with three columns as "Name","Size" and "Date/Time" having datatype as text,Integer and datetime.
0
1428
by: Brian Henry | last post by:
I cant seem to remember this one... I have a list view, and im owner drawing the items, i dont want the selection to hide when it loses focus so i have hideselection = false, but when i owner draw this all the items come up gray instead of just the one that is selected when focus is lost, the blue one shows up correctly when it has focus... any help on this would be great... i need to do most of my drawing in the sub items drawing because...
2
2807
by: Xafier | last post by:
Hi, I'm creating a control that overrides ListView and so I'm working on redrawing everything myself with some changes here and there... But I'm having a problem with drawing the text inside the rectangle on LargeIcon mode... I thought I'd finally discovered the solution with TextRenderer but this still doesn't give the correct results. Here's the code I'm trying to use (item is a ListViewItem)
12
3413
by: garyusenet | last post by:
I have had no replies to my previous post so perhaps I didn't write it good enough. Please excuse new thread but i wanted to break from the last thread hopefully this thread will be better. Very simple. I would like to create listviewitem's for display in a listview control. The listview items need to contain properties from Internet Explorer windows i've managed to collect into an arraylist.
13
10234
by: deciacco | last post by:
How can I have access to the items collection of a listview control on my form from a background thread? I know I need delegates to update the listview control and I have those calls in the foreach loop, but I'm not sure how to access the items collection. foreach (ListViewItem li in this.listview1.Items) { Invoke(new deleg(updatectrl), new object { param });
1
4801
by: schnandr | last post by:
Hi, I have a user control which contains ListView. I copy all ListViewItems into a separate List<ListViewItemcalled unfilteredItems. I am using a BackgroundWorker to filter the ListView. When I access this list in the DoWork Handler I am getting an InvalidOperationException that the List was not created by this thread. Is there a way to solve this problem?
0
9483
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
10157
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
10096
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
9956
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...
0
8982
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5386
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...
0
5514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
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
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.