473,748 Members | 7,142 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ListView / Show Any Subitem

private void listView1_Selec tedIndexChanged (object sender, System.EventArg s
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 4463
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_Selec tedIndexChanged (object sender, System.EventArg s 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********@int heformofaquesti on.com> wrote in message
news:kI******** *********@fe37. usenetserver.co m...
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_Selec tedIndexChanged (object sender,

System.EventArg s
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
21259
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
23704
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 ). If possible, what do I do to activate that 'cell' - thanks. I thought that listView.LabelEdit = true; would enable me to navigate into the cells or something like listView.items .subitems.LabelEdit - but I did not see such a property....
2
4733
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 images to listview also(This is to list all the items in my inbox, and want to give the user the feel of outlook). Since it hangs for even 1000 items in the inbox, i tried to shift to virtual listview. But virtual listview
6
5037
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 this possible? I intend on replacing an ActiveX grid with a listview control from a VB6 application that I've upgraded to VB .NET. The existing functionlality uses the mouseover event of the grid to display specific information within...
0
1374
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 it i have to catch the listviewItem and than itarate through all the subitem and find out which item has the mouse pointer. but the problem for this solution is, what if there are lots of columns in the listview and what if the user is hovering...
10
12285
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 below however the subitems doesn't have an overload allowing an image index. Adam
1
5242
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); listView1.Columns.Add("Column 2", 100,HorizontalAlignment.Center); listView1.Columns.Add("Column 3", 100,HorizontalAlignment.Center); listView1.Columns.Add("Column 4", 100,HorizontalAlignment.Center); System.Windows.Forms.ListViewItem itmp = new
1
6417
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 have overridden the DrawColumnHeader, DrawItem, DrawSubItem methods as displayed below. It is drawing the icon correctly, however, when I click on a row, the middle column, eg. column 1 is not being shown as selected. All other columns look selected...
3
25008
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) lstBrowse.Columns.Add("Col3", 150, HorizontalAlignment.Left) lstBrowse.Columns.Add("Col4", 150, HorizontalAlignment.Left) lstBrowse.Columns.Add("Col5", 150, HorizontalAlignment.Left) lstBrowse.Columns.Add("Col6", 150, HorizontalAlignment.Left)
0
9541
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9370
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
9321
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
9247
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
8242
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
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4602
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...
1
3312
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
2782
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.