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:
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!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
Please can anyone tell me where I'm going wrong? Thanks!




Reply With Quote