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)
-
I know how to get the selected item. -
Dim SelectedOptions As ListView.SelectedListViewItemCollection = lstBrowse.SelectedItems
-
Dim Item As ListViewItem = Me.lstBrowse.SelectedItems(0)
-
But I need to give the opportunity to the end user, to select a subitem.
I want to know how to get the selected subitem because I will fire different procedures for every subitem clicked in a item.
I will appreciate if anybody can show me, how to do that...
Thanks in advance,
3 24985
Hi,
Even I have this problem.
Please reply if somebody has found the solution.
Regards,
Smita
When the View property is set to "Details" you can't select a sub item because selecting an item selects the whole row.
I'm not sure about other view types.
You can, however, find the text value of a sub item. - Me.lstView1.SelectedItems(0).SubItems(1).Text
I use this sequence of code:
It returns the row the user clicked in (as integer)
Further processing may be done in calling routine. In this case only a MsgBox is used now.
e.g.:
‘ within calling routine: (e.g. from the box-click-event, where parameters are sender and e) - Dim sel As ListViewItem = approofBox.GetItemAt(e.X, e.Y)
-
MsgBox("row=" & getClickedRow(approofBox, e) & vbCrLf & " represents " & sel.SubItems(getClickedrow(approofBox, e)).Text & vbCrLf & sel.ToString)
... will show the clicked row, clicked item AND item in column(0)
' called routine: - Function getClickedRow(ByVal box As System.Windows.Forms.ListView, ByVal e As System.Windows.Forms.MouseEventArgs) As Integer
-
Dim eex As Integer = 0
-
Dim appb As System.Windows.Forms.ColumnHeader
-
getClickedRow = -1
-
While (eex < e.X)
-
appb = box.Columns(getClickedRow + 1)
-
eex = eex + appb.width
-
getClickedRow = getClickedRow + 1
-
End While
-
End Function
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Paddy |
last post by:
I would like to do this:
private void listView1_SelectedIndexChanged(etc)
{
// show the subitem of the item that was clicked
}
Please help.
Paddy
|
by: Steve Murphy |
last post by:
Is there a way to set a selected index for a Listview in a WinForms
application?
Thanks in advance,
Steve Murphy
|
by: Webermax |
last post by:
Hello,
I want to retrieve the index of the selected item in a context menu
synchronously. I coded something like this :
MyContextMenu mcm;
mcm = new MyContextMenu ();
mcm.MenuItems.Add (new MenuItem ("hello"));
mcm.MenuItems.Add (new MenuItem ("world"));
mcm.Show ();
|
by: baret bonden |
last post by:
Trying to return a selected listbox item to another form .tried lots of
ways; defining public variables and passing those as well as textboxes ..I'
m able to display the chosen item on it's form in a textbox and I'm able to
pass other variables to the 2nd form, but not the data I want . I should add
this is a smartdeviceapplication(if that matters; not sure)
Here's most of the test code .
|
by: ljlevend2 |
last post by:
I've noticed that selected items in a ListView are only highlighted if the
control has focus. I find this to be highly undesirable because it can cause
the control to behave differently than what would be expected based on the
visual appearance. Is there any way to force the selected items to be
highlighted even when the control does not have focus?
Thanks,
Lance
| |
by: Brian Henry |
last post by:
Since no one else knew how to do this I sat here all morning experimenting
with this and this is what I came up with... Its an example of how to get a
list of items back from a virtual mode list view in .NET 2.0 with multiple
selection turned on... since the .NET documentation is EXTREAML vague on how
to do this and offers no clue on what the virtual mode events do or how to
use them... just thought this might help someone else out...
|
by: NeilS |
last post by:
Hi all.
I'm a newbie at VB.net, so please forgive me if this is well documented
somewhere.
I've found some sample code on the MS site for iterating over each
unread item in the Inbox, and that's working and got me started well in
automating Outlook 2003.
|
by: Mike Johnson |
last post by:
How do I remove a item that's been selected from a listview?
I'm using Visual Basic 2005 express edition. Thanks
|
by: Brett Wesoloski |
last post by:
I am having a bit of a problem getting the current value of the checkbox
list.
I have tried using the selected value as I thought that would give me the
current value of the check box but it appears to be giving me the first
value that is selected all the time.
I have also tried to use the selectedItem property but that does the same as
I would expect becuase the property says it get the item with the lowest
value.
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
| |
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...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |