Solved

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

Posted on 1998-10-09
3
185 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now