Results 1 to 8 of 8

Thread: [RESOLVED] ListView Control - Allow User Editing !??

  1. #1

    Thread Starter
    Superbly Moderated NeedSomeAnswers's Avatar
    Join Date
    Jun 2002
    Location
    Manchester uk
    Posts
    2,657

    Resolved [RESOLVED] ListView Control - Allow User Editing !??

    Hi i have a Listview in one of my projects (in Report view) that i need the user to be able to click on any cell and modify the value.

    My Listview has 4 columns which i populate in the following manner !!

    VB Code:
    1. Public Sub ListSetup(lst As ListView,n As Integer)
    2.  
    3. 'Litems Array is Created and populated elsewhere !
    4.  
    5. Dim lvi As Object
    6.  
    7. Set lvi = lst.ListItems.Add(, "A" & CStr(n), Litems(0))
    8.     lvi.SubItems(1) = Litems(1)
    9.     lvi.SubItems(2) = Litems(2)
    10.     lvi.SubItems(3) = Litems(3)
    11.     lvi.SubItems(4) = Litems(4)
    12.  
    13. End Sub

    My problem is that no matter what option i try i can't seem to make all the Cell's editable when you click into them. Only the rows in the first column are editable !!!!

    Also only the rows in the FIRST column will highlight when you click on them.

    So, does anyone know of a way to change this behaviour so that the user can edit any cell in the Listview by double clicking on it, as changing the LabelEdit property only seems to work for first Column !

    Thanks
    Rich

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: ListView Control - Allow User Editing !??

    I don't see any editing code, but let me suggest a flxgrid. It is very versatile, and allow you to format and edit any cell.

    Search the forum for MS FLEXGRID

  3. #3

    Thread Starter
    Superbly Moderated NeedSomeAnswers's Avatar
    Join Date
    Jun 2002
    Location
    Manchester uk
    Posts
    2,657

    Re: ListView Control - Allow User Editing !??

    Yes i thought that might be the route i would have to go down !!,

    can you populate a FlexGrid from an Array ??, they are not bound to a DB or anything ??

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: ListView Control - Allow User Editing !??

    I prefer ListViews and use textboxes for editing.

    When a listview item is selected, I dump the whole row to individual textboxes any of which can be modified. Saving writes the modified data back to the database, updates the listview and clears our the textboxes. My customers like it as they can easily modifiy any column within any row of the ListView.

  5. #5
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871

    Re: ListView Control - Allow User Editing !??

    You can try using my LabelEdit SubItems code; it uses a textbox to let users edit individual cells.
    Author for Visual Basic Web Magazine

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

  6. #6

    Thread Starter
    Superbly Moderated NeedSomeAnswers's Avatar
    Join Date
    Jun 2002
    Location
    Manchester uk
    Posts
    2,657

    Cool Re: ListView Control - Allow User Editing !??

    Thanks TheVader !!!

    I Like your Subclassing solution alot works great !

    Unfortunatly i can't use it in some of my VBA application as you can't get a proper handle on the Userform object in VBA and the code error's, but have already put this into use in one of my VB projects to great effect !!!

    Thanks you !!

  7. #7
    Addicted Member Darren M.'s Avatar
    Join Date
    Nov 2005
    Location
    D/FW
    Posts
    200

    Re: ListView Control - Allow User Editing !??

    Quote Originally Posted by Hack
    I prefer ListViews and use textboxes for editing.

    When a listview item is selected, I dump the whole row to individual textboxes any of which can be modified. Saving writes the modified data back to the database, updates the listview and clears our the textboxes. My customers like it as they can easily modifiy any column within any row of the ListView.
    Old thread, I know, but that's what the search is for, right? Anyway, Hack. Can you explain/show how you get the row that the user has selected? I'm trying to do basically the same thing but with a collection.
    Thanks!

  8. #8
    Addicted Member
    Join Date
    Jan 2007
    Posts
    138

    Re: [RESOLVED] ListView Control - Allow User Editing !??

    i'm just curious .. does this confirm that the ListView control do not allow user edit? Meaning we need to use the workaround such as having a hidden textbox and etc right?

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