Results 1 to 9 of 9

Thread: [RESOLVED] edit listview listitem data

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    584

    Resolved [RESOLVED] edit listview listitem data

    hello,how to edit listview listitem data???i know datagrid can edit the data at the row.is possible listview to done this as well??

    please help!Thanks!

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

    Re: edit listview listitem data

    I use Listviews in almost every project I do, and I edit a listview row by clicking on it, and then populating textboxs with the listview data.

    The data is changed, in the textboxs as desired, and then the Save button updates the record in the backend database, clears out the listview, and reloads it.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    584

    Re: edit listview listitem data

    hack,
    thanks your information.

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

    Re: edit listview listitem data

    Well, that works for me and my user community.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    584

    Re: edit listview listitem data

    Hack,
    hi ya.i want to delete the listview selected listitem.when select the delete listview listitem to delete have error message come out "Index Out of Bound".

    this is the current code:
    Code:
    Private Sub cmdDelete_Click()
    Dim i As Integer
    
      For i = 1 To ListView1.ListItems.Count
        If (ListView1.ListItems(i).Checked = True) Then
          ListView1.ListItems.Remove (i)
        End If
    
      Next i
    
    End Sub
    Thanks for help!
    Attached Images Attached Images  
    Last edited by gracehskuo; Dec 6th, 2007 at 02:05 AM.

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    584

    Re: edit listview listitem data

    ok,now i solved the index out of bounds error.but then i face another problem,i can delete all the selected lisitem to delete excepted the last row listview listitem cannot delete.please help i want all the selected listitem able to delete.

    this is the current code:
    Code:
    Private Sub cmdDelete_Click()
    Dim i As Integer
    
      For i = 1 To ListView1.ListItems.Count - 1
        If (ListView1.ListItems(i).Checked = True) Then
          ListView1.ListItems.Remove (i)
        End If
    
      Next i
    thanks for help!
    Attached Images Attached Images  

  7. #7
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: edit listview listitem data

    For i = ListView1.ListItems.Count To 1 Step -1

    You don't need to adjust by -1 since ListItems collection is 1-based (first item at index 1) and not zero-based (eg. List() of ListBox, first item at ListIndex zero). And you have to iterate in reverse order because the indices shift (another listitem fills index 1 after listitem at index 1 is removed) after you remove an item from the collection.

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    584

    Re: edit listview listitem data

    leinad31:
    hi.thanks ya.the problem solved.

  9. #9
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: edit listview listitem data

    No problem. Please take the time to mark the thread as resolved.

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