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!:)
Printable View
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!:)
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.
hack,
thanks your information.:afrog:
Well, that works for me and my user community.
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:
Thanks for help!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
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:
thanks for help!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
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.
leinad31:
hi.thanks ya.the problem solved.:afrog: :afrog:
No problem. Please take the time to mark the thread as resolved.