Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'm using the following code to position a textbox over the selected listview subitem

 

dim selSubitem as ListViewItem.ListViewSumItem

   Private Sub ListView1_MouseDoubleClick(......).....
       Dim info As ListViewHitTestInfo = ListView1.HitTest(e.X, e.Y)
       'MessageBox.Show(info.Location.ToString)
       selSubItem = info.SubItem
       txtEdit.Width = info.SubItem.Bounds.Width + 2
       txtEdit.Height = info.SubItem.Bounds.Height
       txtEdit.Location = info.SubItem.Bounds.Location + ListView1.Location
       txtEdit.Text = info.SubItem.Text
       txtEdit.Visible = True
       txtEdit.Focus()
       txtEdit.SelectAll()
   End Sub

 

But this only works correctly when clicking on an actual subitem

When used on the first column in the listview it makes txtEdit.width = listview.width and not just that column

 

any ideas on how to fix this or determine whether i clicked the first column or not?

Posted

perfect solution

thank you.

       If (selSubItem.Equals(ListView1.Items(info.Item.Index).SubItems(0))) Then
           txtEdit.Width = info.Item.SubItems(1).Bounds.Left
       Else
           txtEdit.Width = info.SubItem.Bounds.Width
       End If

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...