473,406 Members | 2,467 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,406 software developers and data experts.

ListView / Show Any Subitem

private void listView1_SelectedIndexChanged(object sender, System.EventArgs
e)
{
textBox1.Text = this.listView1.Items[0].SubItems[1].Text;
}

This will display sub item [1] after cklicking on item [0]
I want to display subitem[1] of any item I click on
how do I do that?
Many thanks.
Paddy.
Nov 16 '05 #1
2 4442
Cast the sender into a ListView (or simply refer to your ListView instance)

ListView lv = sender as ListView;

Get the SelectedItem and refer to it's subitem at position 0

ListViewItem lvi = lv.SubItems[1];

etc etc etc ....

Alex

"Paddy" <no@spam.pls> wrote in message
news:e9***************************@freeler.nl...
private void listView1_SelectedIndexChanged(object sender, System.EventArgs e)
{
textBox1.Text = this.listView1.Items[0].SubItems[1].Text;
}

This will display sub item [1] after cklicking on item [0]
I want to display subitem[1] of any item I click on
how do I do that?
Many thanks.
Paddy.


Nov 16 '05 #2
Hi Trebek.

This doesn't compile.

Error: ListView does noy contain a definition for SubItems

:(

Please help some more.

Paddy
"Trebek" <al********@intheformofaquestion.com> wrote in message
news:kI*****************@fe37.usenetserver.com...
Cast the sender into a ListView (or simply refer to your ListView instance)
ListView lv = sender as ListView;

Get the SelectedItem and refer to it's subitem at position 0

ListViewItem lvi = lv.SubItems[1];

etc etc etc ....

Alex

"Paddy" <no@spam.pls> wrote in message
news:e9***************************@freeler.nl...
private void listView1_SelectedIndexChanged(object sender,

System.EventArgs
e)
{
textBox1.Text = this.listView1.Items[0].SubItems[1].Text;
}

This will display sub item [1] after cklicking on item [0]
I want to display subitem[1] of any item I click on
how do I do that?
Many thanks.
Paddy.


Nov 16 '05 #3

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

Similar topics

2
by: John Lauwers | last post by:
I know you can edit the first column of the listview control, is there a way to edit the second and/or the other columns? greets John
1
by: andrewcw | last post by:
The clcik event on the ListView control seems to trigger off the item level ( the first column ). I would like to be able to trap the click event on a particular subitem ( a specific column's row...
2
by: Anushya devi | last post by:
Hi All I used listview and tried to update it by using Addrange. When the number of items is less, it works fine.. But I need to update nearly 200,000 items and it hangs. Also i need to add...
6
by: Jack | last post by:
Hello, I've noticed through searching this group's previous posts that one can get the item the mouse is over in a listview control but I did not see how to get the subitem the mouse is over. Is...
0
by: Lucky | last post by:
hi guys, i'm looking for a soultion that helps me to show the subitem text of the listview control in the tooltip when the mouse pointer hovers on the subitem. i've found on solution, according to...
10
by: Adam Honek | last post by:
This is probably a silly question but oh well, I can't find the answer looking via code. Having an imagelist already, how does one set an icon for a list view's sub items? I'm using the code...
1
by: plmanikandan | last post by:
Hi, I have a listview with items,subitems.I tems and subitems are added as below listView1.View = View.Details; listView1.Columns.Add("Column 1", 100,HorizontalAlignment.Center);...
1
by: James | last post by:
Hi All, I have an ownerdraw ListView control. I'm trying to use an ownerdrawn ListView control to draw and display images in the second column of a listview which is set to detail view. I...
3
by: luiggye | last post by:
Hi I have a LISTVIEW where every item have 6 subitems (columns). lstBrowse.Columns.Add("Col1", 150, HorizontalAlignment.Left) lstBrowse.Columns.Add("Col2", 150, HorizontalAlignment.Left)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
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,...
0
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...
0
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,...
0
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...
0
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...
0
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...
0
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,...

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.