Solved

Help:Make the 1st col of ListView a TreeView?

Posted on 1998-10-09
3
229 Views
Last Modified: 2010-04-30
I'm trying to simulate a message board similar to that used in the Outlook Express newsreader which has a ListView control with the first column appearing in a TreeView format. Is there a control that does this automatically or is is done manually? Either way, could someone please let
me know where to find the control or how to add the tree structure to the first column?
Any help would be greatly appreciated.
Shi Jun
0
Comment
Question by:shijun
3 Comments
 
LVL 3

Expert Comment

by:TheAnswerMan
ID: 1439168
Send me a screen shot of what you are talking about..
Myxlplick@msn.com
0
 

Author Comment

by:shijun
ID: 1439170
Dear hanzala,
Thank you but I think you may misunderstand or minimize this problem. You can use Outlook Express and look what the news looks like. And the tree view can displayed in any position, as well as in 1st col.If I follow you idea I think I should combine a tree view and some listviews. Thank you any way. Shi Jun

0
 
LVL 15

Accepted Solution

by:
ameba earned 100 total points
ID: 1439172
' declarations, in module
Public Type LVITEM
    mask As Long
    iItem As Long
    isubitem As Long
    State As Long
    stateMask As Long
    pszText As String
    cchTextMax As Long
    iImage As Long
    lParam As Long
    iIndent As Long
End Type
Public Const LVM_SETITEM = (LVM_FIRST + 6)
Public Const LVIF_INDENT = &H10&

' in form
' add listview, two columns, and add some items
' in debug window (or commandbutton) try:
' setindent(2,1)
Private Sub SetIndent(ByVal lIndex As Long, ByVal lIndent As Long)
    ' lIndex is 1-based; just pass the ListItem's .Index property
    ' lIndent is the amount of indentation desired; the unit of
    '         measurement is the width of the list item's image.
    Dim LVI As LVITEM
    Dim lRet As Long
    With LVI
       .iItem = lIndex - 1 ' winapi index is 0 based, VB is 1 based
       .mask = LVIF_INDENT
       .iIndent = lIndent
    End With
    lRet = SendMessage(ListView1.hwnd, LVM_SETITEM, 0, LVI)
End Sub


Is this what you want?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question