Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Selected Subitem In A Listview


How do I determine which listview column has been clicked on?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Listview Selected Subitem - Urgent !?
Hi..

Ive trawled thru this forum before adding this post but cant find what Im looking for - not even sure if its possible.

I am trying to use graphics to allow me have multiple checkboxes in a listview control. Three of the columns I am loading are boolean and so I display a tick/untick graphic when loading - works fine.

However, i want to be able to trap if a user clicks one of these graphics (i.,e. subitems) and toggle it accordingly. I know how to get the row, but is it possible to get the clicked column ?

Any help really appreciated

Adding Text To A Selected Subitem In A Listview
How do I add text to a selected subitem in a listview. Right now I have it setup so that I right click on the item but when I right click to add the text it only adds it to the top item not the selected one.


Code:

Private Sub ListView1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim bln As Boolean

On Error Resume Next
If Button = 2 Then
bln = ListView1.HitTest(x, y).Selected
If bln = True Then
PopupMenu mnuPopup1
End If

ListView1.ListItems(1).SubItems(1) = "Yes"

End If
End Sub
I am wanting to know how to add it to the selected item.

Adding Text To A Selected Subitem In A Listview
How do I add text to a selected subitem in a listview. Right now I have it setup so that I right click on the item but when I right click to add the text it only adds it to the top item not the selected one.


Code:

Private Sub ListView1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim bln As Boolean

On Error Resume Next
If Button = 2 Then
bln = ListView1.HitTest(x, y).Selected
If bln = True Then
PopupMenu mnuPopup1
End If

ListView1.ListItems(1).SubItems(1) = "Yes"

End If
End Sub




I am wanting to know how to add it to the selected item.

Selected Item Or Subitem
I have a multi-column listview (report view).
If the user clicks on a SUBITEM (not item) , is it possible to know which subitem is clicked ?

or

to identify the user just clicked on ITEM or SubItem ?

thanks

How To Get Subitem In Listview
Hi folks,

How can i get the first subitem from a listview?
I know how to get the first using selecteditem but i can't get the first

ListView And URL To SubItem ?
Hello,
I use below code for my api and here is sample of text what I load and what I need next.
My listview are CheckBoxes!

This is List.txt
======================================================
My File1:v.1.0:Great SW:http://www.something.com/get something1.zip
My File2:v.1.0:Great SW:http://www.something.com/get something2.zip
My File3:v.1.0:Great SW:http://www.something.com/get something3.zip
My File4:v.1.0:Great SW:http://www.something.com/get something4.zip
======================================================

I dont want to load URL link in listview
When I select for example 2 checkboxes and press commadn2
to be able download thouse 2 file, 1 afther another
Any help are welcome


VB Code:
Private Sub Command1_Click() On Error GoTo listviewERRORListView1.ListItems.ClearListView1.ColumnHeaders.ClearDim itmX As ListItem ' Create a variable to add ListItem objects.    Dim clmX As ColumnHeader ' Create an object variable for the ColumnHeader object.    Dim ff As Integer    Dim strParts() As String    Dim strLine As String        ff = FreeFile       ' Add ColumnHeaders.    Set clmX = ListView1.ColumnHeaders.Add(, , "File", ListView1.Width / 2.5)    Set clmX = ListView1.ColumnHeaders.Add(, , "Version", ListView1.Width / 2.5)    Set clmX = ListView1.ColumnHeaders.Add(, , "About", ListView1.Width / 0.5)    ListView1.BorderStyle = ccFixedSingle ' Set BorderStyle property.    ListView1.View = lvwReport ' Set View property to Report.       Open "C:List.txt" For Input As ff        Do Until EOF(ff)        Line Input #ff, strLine        strParts = Split(strLine, ":")        ' Add a main item        Set itmX = ListView1.ListItems.Add(, , RTrim(strParts(0)))        ' Add a subitem for that item        itmX.SubItems(1) = strParts(1)        itmX.SubItems(2) = strParts(2)    Loop     Close ff    Exit Sub    listviewERROR:    List1.Clear    List1.AddItem "Error number 14001!" ' File are modified        Exit SubEnd Sub

Listview Subitem
Hi there,

is it possible to loop thru a listview with subitems
and get all stored values from subitem(i), add them together like

listview1.subitem(10) = 10
listview1.subitem(10) = 10
listview1.subitem(10) = 10

label1.caption = 30

i already tried looping to the right and left, up and down but never worked ...

ListView Subitem
Whats the best way to get both ListItem and its corresponding SubItem saved into a String?

ListView SubItem
Hi,
I want add icons in listview subitems....is it possible?....any body know abt this plz reply me......thanks in advance.....

Regards,
Kavi_k

ListView Subitem Help
[size=3][font=arial][color=blue]

Okay, here is what I am trying to accomplish:

I have the first record of a recordset (Jon, Johnson, hisaddress, etc) in the first column of a listview control. The second column contains the actual field header that it falls under ('Field1, Field2, Field3, etc.).

There is a ton more but basically, I want to search for an item in column one, by finding a column two string. Once again, I need to search for "Field5" and pull back the item from column one that corresponds to "Field5", like "zip code".

Any ideas?

Getting The Subitem In A Listview......
this code:

lisview1.selecteditem

The above statement only display the listitem of the selected item. How can i obtain the subitems of this selected listitem ????

Listview Edit Subitem
How might I go about Editing Subitem in a Listview... Heres an idea I have about it

Working a basic example for learning purposes so I have made a simple LV and populated it with Data..
Main Subitem(1) Subitem(2)
Headers are LastName Firstname PhoneNumber


ok I want to select a row Click an cmdEdit it transfer the slected rows data to 3 TextBoxes while removing it from the Listview....allowing me to edit it then add it back sort of a crude edit...NOTE: I already have the code in place to add it back.... need code to remove item from Listview and populate the 3 textboxes....
FirstName LastName PhoneNumber
Text1(0).Text Text1(1).Text Text1(2).Text

Ofcourse, if I could edit the Subitems like I can the Main by smply clicking on it and typing in new data tha would be better I think

vbMarkO

Searching Subitem In A Listview
Is it possible to do a lvwPartial find on a listview subitem. I thought I read somewhere that you can not... If that is true is there some way to get around that.

Thanks

ListView SubItem Icon
On the ListView, I am trying to get the icon number for the SubItem icon. I have two icon colums on my ListView. One is a SmallIcon, the other is a SubItem icon.

This is the code to add a SubItem icon:


Code:
.ListItems(Index).ListSubItems.Add , , , ICON, TOOLTIP
I would like to know how to find out what the ICON variable is and also the TOOLTIP.

Any ideas?

Edit Subitem In Listview
i havin difficulties in dealin this
how do i code to make when i click on the subitem column i can change the record of the selected row

Listview SubItem's Question
how can i add a subItem of a listview as checkbox?

Is There Possible To Add Image Into Listview Subitem ?
Hi all,

I read all the search item from vbforums, I found a lot of thread discussing about add image to subitem. Now, I have a question is it no matter what type of image or picture can load into listview subitem ?



Thanks in advance

Getting Subitem Values From Listview
Hi

I'm very new to VB6 so apologies if this is an obvious question....

I have a listview that has 4 columns. The first column which has an index of 1 according to the property page, is hidden by having its width set to 0. When the user clicks on a row in the listview, I want to be able to get the values from each of the columns and assign them to variables. But I'm having trouble. Here's my code:


Code:
Private Sub lvwAudit_ItemClick(ByVal Item As MSComctlLib.ListItem)
Dim ind As Integer
Dim itm As ListItem
ind = Item.Index
cmdEditAudit.Enabled = True
AuditInfoID = lvwAudit.ListItems(ind).SubItems(1)
AuditCheckDt = lvwAudit.ListItems(ind).SubItems(2)
AuditNxtChkDt = lvwAudit.ListItems(ind).SubItems(3)
AuditCmnts = lvwAudit.ListItems(ind).SubItems(4)
End Sub


When using this code, the "lvwAudit.ListItems(ind).SubItems(1)" bit gets the value from the second column and misses out the first entirely. The "lvwAudit.ListItems(ind).SubItems(4)" is an invalid property. I tried changing the 1 to 0 to get the value from the hidden column but it says that is an invalid property as well. It's like it ignores the existence of the hidden column altogether!

Please can anyone tell me where I'm going wrong? Thanks!

How To Add Listview Subitem By Txt File!
There has a txt file (my.txt) and contents follow:


Quote:





11,user1,pwd1,value1
12,user2,pwd2,value2
13,user3,pwd4,value3
14,user4,pwd4,value4
……






How to make every line in txt into listview subitem.
for example:


Quote:





Oder - user - pwd - value
11 user1 pwd1 value1
12 user2 pwd2 value2
………………







This is my code

Code:
Private Sub Command1_Click()
Dim fso
Dim txtfile, strtxt
Dim a() As String
Set fso = CreateObject("Scripting.FileSystemObject")
Set txtfile = fso.OpenTextFile(App.Path & "my.txt", 1, TristateTrue)
Do Until txtfile.AtEndOfStream
strtxt = txtfile.ReadLine
a = Split(strtxt, ",")
ReDim a(3)
for i=0 to 3
ListView1.ListItems.Add.SubItems(i+1)=a(i)
next i
Loop
txtfile.Close
End Sub

my code cann't run
which wrong?
i think u can understand my statement.

Loop Through A Listview Subitem
ive got for e..g

Text1.Text = "Harry"

now i need to loop through my listview1 box subitem 2 to check if the name harry exists e,g...

any ideas guys?

Top And Left Of Listview Subitem
hi,
how to get the top and left of the subitem of my current selection.
pls. help me.

thanks...
popskie

Listview Subitem Edit
hi,
I have listview with report style.It is posible to edit the subitems of the listview?

Popskie

Which Column A Listview Subitem Is...
Hi, could someone please show me how to determine which column a listview subitem is when clicked, thanks.

ListView - Check Box On Subitem, Possible?
Hi all,

I want to put check boxes as the 5th column of a listview - ie. a subitem.

My question is, is this possible/feasible?

Cheers
Bill

ListView Click - SubItem
I have a listview, with 2 colums, one is the name and one is the last name...
I added 4 listItems in the name section, and then the last names as subitems.
How can I click any item in the NAME section, and make a message box pop up saying what it's subitem (last name) is?? I have tried with the following code, but it doesn't work.

------------
Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)
MsgBox ListView1.SelectedItem.SubItems
End Sub
------------

How To Add An Image In Listview Subitem
How to insert a bar like image or picture in the Listview control's second subitem of column header.

Any Way To Add Image To A ListView SubItem?
You can obviously add an icon to a listItem, but is there anyway to add a graphic to a ListView SubItem (in lvwReport)? I have a column in my listView where the value can be "yes" or "now", and I would like to use a gaphic check for yes and a graphic X for no.

Thanks for any help...

Top And Left Of Listview Subitem
hi,
how to get the top and left of the subitem of my current selection.
pls. help me.

thanks...
popskie

Listview Subitem: Combobox
Is it possible to add a combo box/drop down to each cell in column 1 of a listview? I did try the method of repositioning of the width, left and top, however i was unable to adjust the height of the combo. Also, this combo was restricted to just the first cell in the first column. What i need to accomplish is add a combo box to the each cell once a button is clicked. So the first time its clicked, a combo goes to Row 1 column 1, the second time its click, a combo goes to row 2 column 1. Any help would be greatly appreciated.


Listview Select Subitem
Hi Guys,

I have a listview object and have created some colomns with headers. Now when the data gets put into the listciew I am trying to select subitem 4 only and not any of the other items in that row. This is for the purpose of clicking on that item to view the full details of that person the the row.

Please can you help me.



 

ListView Subitem Text?
How would I go about getting the text of a subitem in a listview? This is what I use to get text in the first column:


for Count = 1 to Line_Type.ListItems.Count
string = Line_Type.ListItems(Count).Text 'This gets the text in column 1
next Count



So now how do i get the text in that row of column two?
Thanks for any advice!!

Setting Listview Subitem To Bold
Is it possible to set the value in a single cell in a listview to Bold (in code) ?

Auto Select Listview Subitem
I'm using the following code to select a listview item, however I really want to be able to apply the same idea to subitems. Can anyone offer some help with syntax please.


Code:
Dim objListItem As Listitem ' want to be subitem(i)

For Each objListItem In Me.ListView.ListItems ' for each subitem(i)
If objListItem.Text = searchVariable Then
Set Me.ListView.SelectedItem = objListItem
Exit For
End If
Next
Thanks very much

Appending Text To A Listview Subitem
How would I go about appending text to a Listview Subitem?

Serch In Subitem Columns In Listview Box
Hi

I am trying to do a search in my secondary columns (1,2) in the list view box. I have 3 in total. Here is the code.

Set itemfound = lstView.FindItem(txtSearch.Text, lvwSubItem, , lvwPartial)


But it does not find anything. What I want is to search the column that is indexed (or sorted). It works fine for the "text" column but no luck with the subitems.

Again I did this in the past but lost the code somewhere.

Any ideas anyone.

Regards

Yamin

HELP: ToolTips For Listview Subitem/item
Hello to all expert

I've have a problem regarding listview subitem on how to use/add tooltips on it... i have read/test the project uploaded by Wokawidget but it seems the only tooltips display are the first column....

please advise..... tnx n advnc

Listview Subitem Question-how To Add Image
I've already posted this before -> http://www.vbforums.com/showthread.php?t=494533
and i get some reply. But, i mark it as RESOLVED before i actually further validate/confirm the solution suggested and i know its my bad. Because of that i have to re-create new thread.

I found out that the solution suggested in my previous thread didnt achieve what i expect. I want to add an image to a subItem(x) but i've tried the solution suggested and it appears to add image to all the subItem.

Is there anyway to do so? Please kindly share if anyone of you know how. Your help is very much appreciated.

Put A Icon In A Listview Subitem Cell?
Hi everyone.

How can i Put a icon in a listview subitem celll?

Thanks to everyone.

Image And Text In SubItem Of A Listview
Hello, does anybody know if it's possible to have a small image and text as SubItem in a Listview, like shown in the picture below?

The images (flags) are in PNG format.

Thanks.

Checking Listview Subitem(1) For Certain Text
i have tried everything and cannot get this to work. what i am looking to do is check all the items in the listview (subitem(1)) to see if a certain text string exists. if the string exists, then to not allow the closing of the app.

this is what i have, any idea?

i am getting argument not optional on highlighted.

VB Code:
Private Sub mnuFileMenuExit_Click()    If lvwUserPunchedOut.ListItems[hl].Item[/hl] = "N/A - New Employee" Then        MsgBox "You cannot close " & Me.Caption & vbNewLine & _               "because some users have never punched in or out yet.", _               vbExclamation, "New Users Present."        Exit Sub    Else        Unload Me    End IfEnd Sub

How Do I Make A ListView Subitem Update !!?
If you CHANGE a propertie of a listitem subitem, the changess will not be visible until the window is refreshed (i.e. Moved, Resized, Minimized/Restored, etc)

Put a ListView and a Command-button on a form and try this:


VB Code:
Private Sub Command1_Click()ListView1.ListItems(1).ListSubItems(1).Bold = FalseListView1.ListItems(2).ListSubItems(1).Bold = TrueEnd Sub Private Sub Form_Load()Dim ipItem As ListItemListView1.ColumnHeaders.Add , , "ID"ListView1.ColumnHeaders.Add , , "Data"ListView1.View = lvwReportSet ipItem = ListView1.ListItems.Add(, , "01")ipItem.ListSubItems.Add , , "Test Item 01"ipItem.ListSubItems(1).Bold = TrueSet ipItem = ListView1.ListItems.Add(, , "02")ipItem.ListSubItems.Add , , "Test Item 01" End Sub


As you see, the second listitem doesn't get bold until you minimize the window and restore it again (at least on my system and others i've tried on). Why this anomality? How do I make it update?

Set Textbox Inside Listview SubItem
I need to "Float" a textbox over a listview subitem to make the
appearance of editing a subitem. I have the detection code for
which subitem was clicked and row, but everything I found was
using the x, y coordinates of the mouse click which does not
accurately position the textbox within the sub item.

How can I set a textbox coordinates to match the subitems
rectangular coordinates? Maybe something like getting the RECT
of the subitem somehow?

Thanks.

Listview Subitem Character Limit
I have a listview in report mode, the subitems seem to be limited to 259 characters. Is this correct?

I am using the following code:


VB Code:
lstProperties.ListItems(index).SubItems(3) = commentsDebug.Print lstProperties.ListItems(index).SubItems(3)


the comments string is 343 characters long, it gets printed correctly in the debug window. However is truncated to 259 characters when displayed on the listview. The column width is wider then the text (I can also resize the column) so I do not belive this is the problem.

Has anyone else experienced this problem, is there a simple soultion. Do I need to change to a different control (flexgrid?)

Thanks.

Setting A Subitem In Listview To Bold
Is it possible in code to set the value of a single cell in a listview to bold (in code)?

How To Loop Thru Listview And Get Subitem?(RESOLVED)
Ok I currently have this:

VB Code:
Dim DOR As Date    For iCnt = 0 To frmReturn.lvwItemR.ListItems.Count        'how do i get the subitem(7) of listitem(iCnt) and set it to variable DOR?    Next

Listview Subitem Update Problem
I'm trying to update a subitem of a .net listview through code and I can't get it to work.

The code I'm using is this:

For Each MyListItem In LVProgress.Items
MyListItem.SubItems(2).Text = "got it"
Next

This should put "got it" in the 3rd column for every listitem right?

For some reason, this is not happening. Through debugging I found that the value is being set but nothing changes on screen. LVProgress.Refresh doesn't have any impact.

Any ideas?

Thanks,
Chig.

Quick Way To Check Value Of A Listview Subitem ?
I have a ListView with nine columns. I would like to check one of the columns (subitems) to see if it has the value "Good". If it does then it should be removed from the ListView. Here's the code I'm currently working with:

...

If ListView1.ListItems.Item(im_2).ListSubItems.Item(im_2).Text = "Good" Then

ListView1.ListItems.Remove (im_2)

Else

MsgBox ("else ran")

End If

...

Thanks for any help.

- Jake

Adding Checkbox To Subitem Of Listview
I can add a checkbox to the item, but how do I add an checkbox to the subitem in the listview control? Is it even possible? If no, which control does support this?

Listview Control And Subitem Text
I can't figure out why this command erases the first item text in that row:

MsgBox "Failed to disconnect " & ListView1.SelectedItem.SubItems(1)

The msgbox appears as it should but the 'main' item text in the selected item row becomes erased.

argh.. help@@

Copyright © 2005-08 www.BigResource.com, All rights reserved