Click here to Skip to main content
15,885,309 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am getting the error "Method or Data Member not found" for ListSubItems whenever I try to compile the project. I have added the SP6 component, MSCOMCTL.OCX. But still I am getting this error. In the drop down ListSubItems is not available.

VB
Public Function SetBoldToListItemInListView(lv As ListView, lvwItem As ListItem, bBold As Boolean) As Boolean
    Dim i As Integer
    On Error GoTo EH

    ResetBoldInListView Not bBold, lv  
    lvwItem.EnsureVisible

    For i = 1 To lvwItem.ListSubItems.Count
        lvwItem.ListSubItems(i).Bold = True
    Next  

    lvwItem.Bold = True 
    lvwItem.Selected = True 
    lv.Refresh  
    SetBoldToListItemInListView = True

ExitProc:
    On Error Resume Next  
    Exit Function

EH:    
    Error_Handler "Support / CheckUncheckItemsInListView"
    Resume ExitProc
End Function


What I have tried:

I have tried to compile multiple times. I have added the components :
Components : Desaware SpyWorks 6 Hook Control, Microsoft Calendar Control 2007, Microsoft Common Dialog Control 6.0(SP6), Microsoft FlexGrid Control 6.0(SP6), Microsoft Hierarchical FlexGrid Control 6.0(SP4) (OLEDB), Microsoft Masked Edit Control 6.0(SP3), Microsoft Tabbed Dialog Control 6.0(SP6), Microsoft Windows Common Controls 5.0(SP2), Microsoft Windows Common Controls 6.0(SP6), Microsoft Windows Common Controls-2 6.0(SP6),


References :
Visual Basic For Applications, Visual Basic runtime objects and procedures, Visual Basic objects and procedures, Microsoft scripting runtime, MIcrosoft Data Formatting Object Library 6.0(SP6), OLE Automation, Microsoft Data Binding Collection VB 6.0 (SP4), Windows API (ANSI), Microsoft ActiveX data Objects 6.0 BackCompact Library,
Posted
Updated 23-Aug-19 22:12pm

1 solution

Assuming the the library is built on the Win32 common controls, then LVITEMA (commctrl.h) | Microsoft Docs[^] does not contain a subitems count, although there is a field containing a column count. I suggest you refer to the documentation for the OCX control to check the correct property name.
 
Share this answer
 
v2
Comments
Member 10711706 26-Aug-19 0:01am    
Problem is with ListSubItems and not with Count
Member 10711706 26-Aug-19 0:02am    
In the drop down I am not getting ListSubItems option.
Member 10711706 26-Aug-19 1:24am    
I checked in Object browser. I have COMCTLLIB and MSCOMCTLLIB ListItems. In MSCOMCTLLIB listitems class is having ListSubitems as member. But it is not there in COMCTLLIB. My project is taking ListItems class from COMCTLLIB. How can i change it to MSCOMCTLLIB as default?
Richard MacCutchan 26-Aug-19 3:18am    
Sorry, no idea. I have not used OCX libraries or VB6 for more than 20 years.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900