Solved

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

Posted on 1998-10-09
3
244 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

690 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