Results 1 to 4 of 4

Thread: Edit content in listview

  1. #1

    Thread Starter
    Addicted Member Jakys's Avatar
    Join Date
    Dec 1999
    Location
    Norway
    Posts
    180

    Edit content in listview

    Hi!
    I need to be able to edit every row under a column in a listview control. VB does this almost automatic with the labeledit property, but only with the listitem (the first column), not the listsubitems..

    I could of course swap the order of my columns, but that would look very weird

    Any suggestions?
    MSN: [email protected]

    "Enhetssirkelen løser alle problemer" - ÅJT

  2. #2
    Frenzied Member McGenius's Avatar
    Join Date
    Jan 2003
    Posts
    1,199
    Something that isn't easy and at the same time isn't difficult to implement: you'll need to create a floating Textbox that perfectly fit inside each cell (especially when gridlines are visible). So, good luck.
    McGenius

  3. #3
    Lively Member
    Join Date
    Nov 2002
    Location
    Perth - Australia
    Posts
    105
    Surely there is an easier way than that... thats crazy talk LOL

  4. #4
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    there is no edit property for subitem labels but you could edit them like this :
    VB Code:
    1. Private listMainItem As String
    2.  
    3. Private Sub Form_Load()
    4. With ListView1
    5.     .ListItems.Add 1, , "item 1"
    6.     .ListItems.Add 2, , "item 2"
    7.     .ListItems(1).ListSubItems.Add , , "subitem 1"
    8.     .ListItems(2).ListSubItems.Add , , "subitem 2"
    9. End With
    10. End Sub
    11.  
    12. Private Sub ListView1_AfterLabelEdit(Cancel As Integer, NewString As String)
    13. ListView1.SelectedItem.ListSubItems(1).Text = NewString '///make the subitem become the edited item.
    14. NewString = listMainItem '/// make the main item back to it's original text.
    15. End Sub
    16.  
    17. Private Sub ListView1_BeforeLabelEdit(Cancel As Integer)
    18. listMainItem = ListView1.SelectedItem.Text '///asign exsisting main item to a string.
    19. End Sub
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

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