ListView + TextBox

ListView + TextBox

Anonymous
Not applicable
412 Views
0 Replies
Message 1 of 1

ListView + TextBox

Anonymous
Not applicable
I need to edit ListView's ( variable lstView) cells. I tried to place TextBox ( variable edBox) above the ListView for editing. Code is shown bellow:

Private Sub lstView_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As stdole.OLE_XPOS_PIXELS, ByVal y As stdole.OLE_YPOS_PIXELS)

Dim hti As LVHITTESTINFO
Dim lngRet As Long
hti.pt.x = x
hti.pt.y = y
lngRet = SendMessage(lstView.hWnd, LVM_SUBITEMHITTEST, 0&, hti)

oRow = cRow
oCol = cCol

cRow = hti.lngItem
cCol = hti.lngSubItem

If cRow = -1 Or cCol = -1 Then Exit Sub

edBox.Left = lstView.ColumnHeaders(cCol + 1).Left + lstView.Left
edBox.Width = lstView.ColumnHeaders(cCol + 1).Width

Dim item As ListItem

Set item = lstView.ListItems(cRow + 1)
edBox.top = item.top + lstView.top
edBox.Height = item.Height
If cCol = 0 Then
edBox.Text = item.Text
Else
edBox.Text = item.SubItems(cCol)
End If

edBox.ZOrder 0
edBox.SetFocus

End Sub


But TextBox don't appear. Please, help.
0 Likes
413 Views
0 Replies
Replies (0)