Results 1 to 2 of 2

Thread: Listview Stuff (Easy labeledit for subitems etc)

  1. #1

    Thread Starter
    Admodistrator |2eM!x's Avatar
    Join Date
    Jan 2005
    Posts
    3,900

    Listview Stuff (Easy labeledit for subitems etc)

    All this requires is a textbox, and it will scroll to the line the user is on and
    VB Code:
    1. Option Explicit
    2. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( _
    3.     ByVal hWnd As Long, _
    4.     ByVal wMsg As Long, _
    5.     ByVal wParam As Long, _
    6.     lParam As Any _
    7. ) As Long
    8. Private Const WM_VSCROLL = &H115
    9. Private Const SB_PAGEDOWN = 3
    10.  
    11. Private Sub Command1_Click()
    12.     Call MoveToItem(ListView1, Text1, 1, 28)
    13. End Sub
    14.  
    15. Private Function MoveToItem(lv As ListView, tb As TextBox, Column As Long, row As Long)
    16. Dim i As Long, NumRows As Long, iRows As String
    17. Dim iStr() As String
    18.     tb.BorderStyle = 0
    19.     tb.Top = lv.Top - 100: tb.Width = lv.ColumnHeaders(Column).Width
    20.     tb.Left = lv.ColumnHeaders(Column).Left + 190: tb.Height = 210
    21.         NumRows = (lv.Height / tb.Height) - 2
    22.         If row > NumRows Then
    23.           iRows = row Mod NumRows
    24.           If iRows <> "0" Then
    25.             iRows = row \ NumRows & ":" & iRows
    26.             iStr() = Split(iRows, ":")
    27.           End If
    28.         Else
    29.             iRows = "0" & ":" & row
    30.             iStr() = Split(iRows, ":")
    31.         End If
    32.            For i = 0 To iStr(1)
    33.                     If row <> 0 Then
    34.                         tb.Top = tb.Top + tb.Height
    35.                     End If
    36.            Next i
    37.            If iStr(0) <> "0" Then
    38.             For i = 0 To CLng(iStr(0)) - 1
    39.                 SendMessage lv.hWnd, WM_VSCROLL, SB_PAGEDOWN, ByVal 0&
    40.             Next i
    41.            End If
    42.             If Column = 1 Then
    43.     tb.Text = lv.ListItems(row).Text
    44.             Else
    45.     tb.Text = lv.ListItems(row).ListSubItems(Column - 1).Text
    46.             End If
    47.             tb.SetFocus
    48. End Function

    ill be adding some more cool stuff in the next few days..just hang on kids

  2. #2

    Thread Starter
    Admodistrator |2eM!x's Avatar
    Join Date
    Jan 2005
    Posts
    3,900

    Re: Listview Stuff (Easy labeledit for subitems etc)

    And i made this, so it will tell what you clicked on and change the textbox to what you item you clicked on:
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width