Results 1 to 2 of 2
  1. #1
    Lounger
    Join Date
    Mar 2005
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Col. edit in ListView??? (VBA/2000)

    Hi Folks,

    As far as I can understand it is next to impossible to edit lables above no. 1 in a LV in VBA? I've seen some solutions but no one works 100%. Do any of you have any ideas on how to overcome such thing - I've even seen one using a floating textbox for it... something like:

    Option Explicit
    Private MouseY As Integer, SelectedListItem As ListItem

    Private Sub lstOutput_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    MouseY = y
    End Sub

    Private Sub lstOutput_DblClick()
    If Not lstOutput.SelectedItem Is Nothing Then
    Set SelectedListItem = lstOutput.SelectedItem
    With txtEdit
    .Top = (lstOutput.Top + MouseY) - Fix((txtEdit.Height) / 2)
    .Left = lstOutput.Left + lstOutput.ColumnHeaders(1).Width
    .Width = lstOutput.ColumnHeaders(2).Width
    .Text = SelectedListItem.SubItems(1)
    .Visible = True
    .SetFocus
    .SelStart = 0
    .SelLength = Len(.Text)
    End With
    End If
    End Sub

    Private Sub txtEdit_LostFocus()
    SelectedListItem.SubItems(1) = txtEdit.Text
    txtEdit.Visible = False
    Set SelectedListItem = Nothing
    End Sub

    Private Sub txtEdit_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
    SelectedListItem.SubItems(1) = txtEdit.Text
    txtEdit.Visible = False
    Set SelectedListItem = Nothing
    End If
    End Sub


    I keep having the problem that txtEdit is (and stayes) below my LV. If no solution is "nice" for this problem - then how do I control SetWindowPos in VBA? *S* (I can't get the handle from a txt-box).



    Kindly,
    Michael, denmark.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Col. edit in ListView??? (VBA/2000)

    Why not display an InputBox, or a popup form?

Posting Permissions

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