Adding Subitems To A Listview
I have 2 ADOR recordsets that Im using to get data from 2 tables in a database. The first recordsets data is to be the first column in the listview. The second recordset to be the subitem. I have tried adding to the listitems text & subitem but only get output of one row. Can anyone please help?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Adding Pictureboxes To The Subitems Of A Listview
Hello, I'd like to add pictureboxes to the subitems of a Listview, so I can use them as a progressbar.
I can probably use SetParent to add pictureboxes to the Listview, but I have no idea how to keep the pictureboxes on the correct position when items are removed or the Listview is sorted.
Does anybody know how to do this?
Adding Icons To Subitems Of A Listview
Hi everyone!
I've tried searching in past threads to do this but failed. In my project, I use a listview with 4 columns and to fill it, I use recordsets from a table in the project's database. What I want to do is to add icons to certains rows in the listview and the icons are to be displayed in the 4th column of the listview. I really hope it can possibly be done.
Thanks a lot in advance for any help from any one of you.
Adding Listview Subitems With Function??
Ok, here's what I'm trying to do. When you click a button in my program the Listview is populated with mp3 files. I have a function to reader the header of the mp3. So here's what I'm trying to do.
Listview1.listitems(i).listsubitems.add , , Mp3info.Bitrate
I want the second column in my listview to be populated with the bitrate by calling the function MP3info, which is in a module in my program.
I need it to get the bitrate of all of my listitems in the listview (column 1), and then let my listsubitems = the bitrate the functionn Mp3info.bitrate returns.
How would I need to arrange my code? Any help is appreciated.
Thanks
-Jeremy
Adding Images To Listview Subitems
I know this can be done I have seen it but am stumped and tired of searching for an answer.
I want to have more than one image in the listview control ie: add images to subitem(s), does anyone know?
Thankyou.
Adding Subitems On Listview From Diff. Txt Boxes
hi guys, right now im adding subitems from different text boxes. That goes like this, on every top of my listview's subitem column, there is a text box.(i.e. the the column 2 has txt name on top of it, column 3 has txt age on top and so on . .), my problem is, everytime i add some subitems the item is added on the same column but in lower row
Code:
ex:column1 column2 column3 column4
item1
item2
item3
item4
here are my current codes
vb Code:
'(public)lvwitem0 is declared as listitem Private Sub txtShipper_KeyPress(KeyAscii As Integer)If KeyAscii = vbKeyReturn Then Set lvwItem0 = Me.lvwWSCR.ListItems.Add(, , Me.txtShipper.Text) Set lvwItem0 = Nothing Me.txtCommodity.SetFocusEnd IfEnd Sub Private Sub txtCommodity_KeyPress(KeyAscii As Integer)If KeyAscii = vbKeyReturn Then Set lvwItem0 = Me.lvwWSCR.ListItems.Add lvwItem0.SubItems(1) = Me.txtCommodity.Text Set lvwItem0 = Nothing Me.cboConSize.SetFocusEnd IfEnd Sub Private Sub cboConSize_KeyPress(KeyAscii As Integer)If KeyAscii = vbKeyReturn Then Set lvwItem0 = Me.lvwWSCR.ListItems.Add lvwItem0.SubItems(2) = Me.cboConSize.Text Set lvwItem0 = Nothing Me.cboLCLVol.SetFocusElseKeyAscii = 0End IfEnd Sub Private Sub cboLCLVol_KeyPress(KeyAscii As Integer)If KeyAscii = vbKeyReturn Then Set lvwItem0 = Me.lvwWSCR.ListItems.Add lvwItem0.SubItems(3) = Me.cboLCLVol.Text Set lvwItem0 = Nothing Me.txtDestination.SetFocusElseKeyAscii = 0End IfEnd Sub Private Sub txtDestination_KeyPress(KeyAscii As Integer)If KeyAscii = vbKeyReturn Then Set lvwItem0 = Me.lvwWSCR.ListItems.Add lvwItem0.SubItems(4) = Me.txtDestination.Text Set lvwItem0 = Nothing Me.txtAISRate.SetFocusEnd IfEnd Sub
can anyone help me?. thank you guys in advance..
Moving A Listview Item And Its Subitems To A New Listview
Hey Guys,
Having a bit of trouble. I am attemping to move a selected item and its subitems from one listview to another. I have no problem getting the contents of the first column, but I can't seem to get the subitems over.
Example: I have this in the first listview:
Code:
|Item |Quanity|Price |PQ |
Bananas 2 $.50 $1.00
Then when I try to move that whole row to the other listview I can only seem to get this:
Code:
|Item |Quanity|Price |PQ |
Bananas
No subitems . Any links or help would be appreciated.
Regards,
Max_Power
Adding Subitems To MsFlexgrid?
i searched pscode and i found one example, but it's kinda hard to understand. i also search this fourm, and it doesnt seem like anyone has asked this question before, so i'll ask...
how do you add subitems to msflexgrid? i can only add one item, and if i try to add another one, it goes to the next line. what i want is to add subitems.
Adding Subitems To Menus At Runtime
How is it possible to add submenus to a menu at runtime.
The code I am using at the moment only adds items:
'mnuTest was added with the menu editor and the index was set
Load mnuTest(11)
mnuTest(11).Caption = "test"
Load mnuTest(12)
mnuTest(12).Caption = "test2"
Thanks
Rob
Listview With Subitems
Hi,
I'm a newbee on VB 6.0 (old stuff I have to maintain ). Now I have this silly problem that I have a listview with 2 subitems. When I click on one item I would like to get the 1. subitem moved to a listbox. How do i do that?
Hope some can help me
Jan
Listview && Subitems
Hello, i tried some searching in the forum and also in the web. There must be possibilities to edit subitems.
"Garrett Sever" made something like this.
can anyone help?
okay, what i need is the following
listview with:
subitem - text
subitem - boolean value (best as checkbox)
both of them editable
any ideas?
ListView SubItems
I have a report type listview with one subitem column. I need to allow the user to select and change the information held within the subitem column. I can easily do it with the listitem column but I do not seem to be able to even select the subitem let alone edit it.
Thanks
Listview Subitems
hey agin, sorry for all the questions but i am stuck again.
i have a list box and i am loading an array into it. i can set the column headers and the first column but how do i set the subitems. i am using vb 6.0
here is the code i use to load the first colum
Code:
ListAdd.ListItems.Add , , Contact(0)
i need to load
contact(1) and 2
i have tried everything i could think of or get off the net. the examples from mdsn site did not work for me. thanks for the time. Pat
Listview/subitems
hi guys, just got a little stuck and im sure its a simple thing lol, well any way here is my problem, i have created a listview with 2 coulum headers
VB Code:
ListView1.ColumnHeaders.Add , , "Profile", 2970ListView1.ColumnHeaders.Add , , "Type", 970
ok, i have loaded everyting into the first coulum (profile) by useing
VB Code:
Set mItem = ListView1.ListItems.Add(, , "VISTER", , 1)
etc etc etc, now in the coulum header 2 (type) i can add the first bit of code to the first line
VB Code:
mItem.SubItems(1) = "Testl"
now how do i add to the next line down in coulum header 2? can you please help thanks..
ListView Subitems
In other apps where I've used the ListView i've added things like this.
VB Code:
Dim itmX as ListView Set itmX = ListView1.ListItems.AdditmX = Item1itmX.SubItems(1) = Item2itmX.SubItems(2) = Item3'etc....
However in a new app i've set everything up the same but when I try to complie to EXE i get a message saying "Method or data member not found" and the below code is highlighted. I can't figure out why it's not working
VB Code:
.SubItems(1)
ListView Subitems
Is it posable to display an Icon in a Subitem column of a ListView control in lvwReport view?
Thanks,
Alex
Listview And Subitems
Got a question for you all.
In this program a module called Recoredset.
This is the area of the problem.
---------------------------------------------------------------------
Public Sub Validate(UserName, Password As String)
Dim Rs As ADODB.Recordset
Set Rs = New ADODB.Recordset
Dim SQL As String
SQL = "Select * from Passwords where UserName = " & Chr(34) & UserName & Chr(34)
Rs.Open SQL, conn, adOpenKeyset, adLockReadOnly
With FrmBMServer
If Rs.EOF = True Then .sckServerWinsockConnection(.InitMax).SendData "InValid UserName": Exit Sub
If UCase(Password) = UCase(Rs!Password) Then
.sckServerWinsockConnection(.InitMax).SendData "Password Validated"
.lvUsers.ListItems.Add , , UserName
.lvUsers.ListItems(1).SubItems(1) = Count + 1
.lvUsers.ListItems(2).SubItems(1) = Count + 2 <- Right Here
Else
.sckServerWinsockConnection(.InitMax).SendData "InValid Password"
End If
End With
Rs.Close
Set Rs = Nothing
FrmBMServer.Label7.Caption = Err.Description
End Sub
---------------------------------------------------------------------
The line that has the arrow next to it is my problem.
I have a ListView set up and it has too columnheaders at the top. First column is UserName.
Second Column is Port Number.
What I want it to do is to put user name in the first column row and the port number in the second column row.
Im not sure on how to do this. There's got to be a way to check if column row's 1 2 3 etc are already filled, and if so add a new one plus need to figuer out how to put a counter in for the port numbers.
So it sould look somthing like this.
column Username | Column Port Number
-------------------------------------
Texg | 1
Bill | 2
ect...
Thanks for your help
TexG
Listview Subitems
Well, i just could not stay away from my code, and soon i found areas for improvement, so i´m back.. =)
This is similar to my other listview problem, but i can´t seem to figure it out. I have a listview with Headers
created by this code (thanks to XTab and DaVBMan). sOuput is used to make up the Headers of the listview.
Code:
ListView1.View = lvwReport
arrHeaders = Split(sOutput, ",")
For i = 1 To UBound(arrHeaders) + 1
ListView1.ColumnHeaders.Add
ListView1.ColumnHeaders(i).Text = Trim(arrHeaders(i - 1))
Next
I have a another comma separated file that i want to split and then use as subitems in the listview.
File might look like below, but is most likely much larger. I need to first get rid of the first line, then split
the file at every comma, and finaly add each "column" as a sub item in the listview. So in this case all three
"maverick" will go into the first column, bootstrap c: mp and index:maverick will go into the second
column and so on. Who´s got a tip to get me started? I´m really having som problems with my Split routines,
not to mention adding subitems in listviews, so all suggestions are welcome. =)
client,name,date-time
maverick,bootstrap,2004-10-05
maverick,c: mp,2004-10-05
maverick,index:maverick,2004-10-05
The file is read here, and i need to split it somewhere along this line and add the subitems.
Text10 is just used to test the code, i want to replace it with my listview.
Code:
Open "c: est.dat" For Input As #1
Do While Not EOF(1)
Label11.ForeColor = &HC000&
Label11.Caption = "Match found!"
Text10.Text = input(LOF(1), #1)
Loop
Close #1
End If
Edited by - Maverick2004 on 10/17/2004 10:55:45 PM
ListView SubItems
Does anyone know of a way to edit values in subitems? What I am trying to achieve is to have the listview populate with values from a table but to allow the user to edit those values and then read the information back to the table.
Adding Subitems Based On The Selection Of Combobox
Hello all,
I have a listview and 3 comboboxes, I can get the first selection from the 1st combobox to display in the listview, but not the selections from the other 2 comboboxes. Comboboxes 2 & 3 are subitems to combobox 1. Can anyone help please?
Thanx a lot in advance and hope to hear from you soon.
Cheers,
ziggy
Listview Subitems Backcolor
Is there any way to change the backcolor of subitems in a listview? Something like this:
Code:
Do Until .EOF
Set itmX = Lvw1.ListItems.Add(, , Rs![F8])
itmX.SubItems(1) = Rs![F1]
itmX.SubItems(2) = Rs![F3]
itmX.SubItems(2) = Trim(itmX.SubItems(2))
itmX.SubItems(3) = Rs![F7]
itmX.SubItems(4) = Rs![F11]
itmX.SubItems(5) = Rs![F12]
itmX.SubItems(6) = Rs![F13]
If Rs![F6] = " " Then
For X = 1 To 6
itmX.Subitems(x).Backcolor = vbred '<=== of course does not work
Next X
End If
Edit Listview Subitems
Hi All,
in the attached picture is an example of the data that i displayed for the user to see in listview. how can i allow the subitems for editing by the users and save the edited datas.
i have searched through forum for similar examples to learn from. however, i am not able to find one. can anyone please help me in this area. thanks a million.
best regards.
Editing ListView SubItems
Is it possible to edit ListView's subitems by clicking on them twice like on the main item and also to select them by clicking only once? And how can I make one column editable and another readonly?
Selecting Subitems In A Listview
I want to make the program select an item of a listview when you click on one of it's subitems/columns. Does anyone know of a good way to do this?
Thx.
ListView's Subitems Question
I added items and subitems into Listview. But, I notice that I can only highlight the item portion (first column) in the Listview, and the subitem portion is inaccessible.
Could somebody give me some advice on how to make the subitem portion highligtable and editable? Thanks a whole bunch for your help. Have a great day!
Listview Tooltip Over SubItems Only?
I'm using this code I found here that works fine for showing each SubItem(1) text in a Tooltip for as the cursor moves over each one. I have 3 columns. Is there a way to show the SubItem(1) Tooltip only when the cursor is over one of the SubItem(1) and not the other columns?
Thanks
Code:
Dim objListItem As MSComctlLib.ListItem
Set objListItem = lstApp.HitTest(x, y)
If Not objListItem Is Nothing Then
lstApp.ToolTipText = objListItem.SubItems(1)
Else
lstApp.ToolTipText = ""
End If
Listview SubItems SmallICon Using ADO
Hi, This is a piece of the code I use to populate the Listview.
Code:
Sub FillListview
Do While Not rs.EOF
Set lvwItem = frmMain.ListView1.ListItems.Add(, , rs.Fields.Item("Field").Value, , "Users") ' << Users = name of Icon in ImageList
lvwItem.SubItems(1) = rs.Fields.Item("Field2").Value & vbNullString
lvwItem.SubItems(2) = rs.Fields.Item("Field3").Value & vbNullString
' ...... etc....
How do I add Icons (Images) to the Listviews Subitem?
I hope that it is possible.
Thanks in advance.
How To Edit Subitems In Listview Vb6?
Is there a way to edit a subitem in listview? I've been searching the forums regarding this but found none. I tried using label edit but i figured that only the 1st column can be edited. It would be nice if a subitem can be edited.
Any suggestions is highly appreciated.
thanks
Hittest On Listview Subitems
Is there any way of implimenting a hittest on listview subitems?
I have several columns open in a listview and when I scroll within the subitem area I want to know which record I am hovering over.
The problem being that when you move off of the main listview item the hittest freezes.
:mike:
Invisible Subitems In A ListView
Is it possible to add subitems to a listview such that they are not displayed (and occupy no space, i.e. there shouldn't be an "empty column")?
The purpose is I want this invisible subitems that musn't be shown to become automatically arranged when I click on a cloumn header to alphabetically arrange the text in each row.
Checkboxes In Listview Subitems
Is it possible to put checkboxes in a listview subitem?
I've seen code that allows you to put pictures in the sub items, but I would like checkboxes.
Thanks.
ListView: SubItems Or ListSubItems?
I have the following called from my Form_Load event.
VB Code:
Private Function Create_Headers() With lvwData .View = lvwReport .FullRowSelect = True .LabelEdit = lvwManual .SmallIcons = ilsImagesSMALL .Icons = ilsImagesLARGE .ColumnHeaders.Add , , "Code", 1000, lvwColumnLeft .ColumnHeaders.Add , , "Company", 2000, lvwColumnLeft .ColumnHeaders.Add , , "Address", 1500, lvwColumnLeft .ColumnHeaders.Add , , "Phone", 1500, lvwColumnRight End WithEnd Function
By using the following procedure I can add data to the ListView:
VB Code:
Private Function AddItem(ByVal Code As String, ByVal Company As String, ByVal Address As String, ByVal Phone As String, ByVal Icon As String)Dim lvwNewItem As ListItem Set lvwNewItem = lvwData.ListItems.Add(, , Code, Icon, Icon) With lvwNewItem .SubItems(1) = Company .SubItems(2) = Address .SubItems(3) = Phone End With Set lvwNewItem = NothingEnd Function
I know that by using ListSubItems I can achieve the same thing:
VB Code:
Private Function AddItem(ByVal Code As String, ByVal Company As String, ByVal Address As String, ByVal Phone As String, ByVal Icon As String)Dim lvwNewItem As ListItem Set lvwNewItem = lvwData.ListItems.Add(, , Code, Icon, Icon) With lvwNewItem .ListSubItems.Add , , Company .ListSubItems.Add , , Address .ListSubItems.Add , , Phone End With Set lvwNewItem = NothingEnd Function
How would I add data to the ListView using the ColumnHeader's KEY? As with the above I have to have the code in the correct order otherwise data will be displayed in the wrong column...
Any ideas?
Listview Subitems As Checkboxes
I am loading some database info into a listview.
This includes four columns of ture or false boolean values.
Instead of displaying 'True' or 'False' in these subitem columns I would prefer to just have a checkbox.
Is this possible? I can't seem to find any info on this.
Cheers.
Checkboxes In Subitems Of A Listview....?
Checkboxes in subitems of a listview....?
I dont have the time or motivation to play with all of the lv style constants. mfc will do it in c++ no problem, Unfortunanly our companys pc's are locked down tighter than any straight mans ass in america, so installing an .ocx is out of the question. Has anyone played enough or possibly heard in some strange conversation of listviews if this is possible?
Listview And Subitems Question
Hello,
I would like to change the text color in a Listview control for all the lines that are Ghosted but the problem is that the text color is changed only in the first column and not for all SubItems.
Thanks for your help,
Thierry Demoy
France
VB6
Remove Subitems From Listview
Ok, i have a listview which the user populates with a bunch of data, licenses to be exact.
I then loop through the listview and compare SubItems(1) with a database. If that item
already exists in the database, i want to remove it from the listview. The listview has 5
columns like below, and i want to clear each row corresponding to SubItems(1), not the
entire listview. I guess i should use ListView1.ListItems.Remove(index), but i´m having
some problems coding the index part so that the item/row the loop is currently on is
deleted. I guess i need to declare an integer that keeps count of the lines processed by
the loop? Any suggestions to this?
itm.Text itm.SubItems(1) itm.SubItems(2) itm.SubItems(3) itm.SubItems(4)
Code:
For Each itm In Me.ListView1.ListItems
objArs.QueryAddQualifier "Add on enabler", 1, itm.SubItems(1)
objArs.QueryAddQualifier "Status", 1, "Permanent"
objArs.QueryOpen
If objArs.GetEntryCnt() > 0 Then
List2.AddItem "Error! License " & itm.SubItems(1) & " already exists!"
' Code needed here to remove the row from ListView1
End If
Next
Cheers!
Maverick
Edited by - Maverick2004 on 12/2/2004 6:06:11 AM
Getting The Values Of Listview Subitems
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!
ListView Problems ; Can't Get Subitems In The Right Row
I've searched everywhere looking for tut's on listview can't find much...
Maybe someone can help.. Its probably something stupid I'm doing but I can't figure it out..
I'm tring to add items and subitems to a listview.. I'm assuming that the subitems(are like the next column)
I can get the first column right but as soon as I try and add a sub item in its spliting my first column to everyother one
and the same with the sub items.. Like:
12345
abcde
678910
fghijkl
202122
This isn't what I want... I need them like:
12345 abcde
67890 fghijk
Here's my code, I'm getting the data from an array & database
I must be doing something wrong here
Code:
rsTblProd1.MoveFirst
For i = 0 To UBound(arrDeleted)
If arrDeleted(0) = "" Then
Exit Sub
End If
rsTblProd1.Find "[Product Code]='" & arrDeleted(i) & "'"
If rsTblProd1![Current Cost] = "0" Then
sCost = "0.00"
End If
With frmResults.lvw
.ListItems.Add , , rsTblProd1![Product Code]
.ListItems.Add.ListSubItems.Add , , rsTblProd1![Description One]
End With
Next i
Thanks for any inputsuggestions
$hep
Edited by - $hep on 10/9/2004 7:35:24 PM
ListView > SubItems > ForeColor
Hi, I've got a strange behaiver setting the ForeColor for SubItems in a ListView.
For some reason wich I can't seem to solve is, ones a SubItem is set to Blue it never goes back into a Black color.
Basically what I try to do is when selecting a row, set a certain SubItem ForeColor to Blue, and all other SubItems in the same column to Black.
But ones a SubItem is Blue, i can't seem to get it Black again.
Any suggestions?
Code:
' you need a ListView1 and Text1
Option Explicit
Private Sub Form_Load()
ListView1.Arrange = lvwAutoTop
ListView1.LabelEdit = lvwManual
ListView1.View = lvwReport
ListView1.FullRowSelect = True
ListView1.ColumnHeaders.Add , , "Icon", 400
ListView1.ColumnHeaders.Add , , "Unique ID", 1500
ListView1.ColumnHeaders.Add , , "Title", 3000
Dim i As Integer
For i = 1 To 5
ListView1.ListItems.Add , , "icon"
ListView1.ListItems.Item(i).SubItems(1) = "uID " & i
ListView1.ListItems.Item(i).SubItems(2) = "Title " & i
Next i
End Sub
Private Sub ListView1_Click()
Dim i As Integer
For i = 1 To ListView1.ListItems.Count
' make all "Title" columns black
' both methods don't work ...
ListView1.ListItems(i).ListSubItems(2).ForeColor = vbBlack
ListView1.ListItems.Item(i).ListSubItems(2).ForeColor = vbBlack
Next i
Dim h As Integer
h = ListView1.SelectedItem.Index
' set the selected "Title" column to Blue,
' this works, both methods ...
ListView1.ListItems(h).ListSubItems(2).ForeColor = vbBlue
'ListView1.ListItems.Item(h).ListSubItems(2).ForeColor = vbBlue
Text1.Text = ListView1.ListItems(h).ListSubItems(2).Text
Text1.SetFocus
End Sub
Edited by - T48 - [RedPlanet] on 9/13/2007 11:19:59 AM
Editing Subitems In Listview
Hi there !
I want to edit subitems in listview.
I click on the listview but the only thing i can edit is the parent column.
I also do not want the parent column to be editable.
Thank you !
ListView With Checkboxes As SubItems
I have scoured the Internet and MSDN, maybe I'm blind, but I can't find anything that tells me how to make checkboxes in my ListView subitems. I know that you can have a checkbox beside the item but that is not what I am looking for. I need checkboxes as subitem data. How can I make that happen?
Thanks.
Merge ListView Items && Subitems
I have LV1 with data and LV2 with updated data. I would like to delete the data in LV2 if it's the same in LV1. For the data to match and be deleted the items and subitems must match. Once the doubles are deleted I can just add to LV1.
The only problem is the deletion of doubles. Any help is greately appreciated.
Silver
|