#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Essex, ON
    Posts
    18
    Rep Power
    0

    deleting a record from a listview


    I have a listview called listview1. It populates just fine. I can refresh the listview everytime I add a record.

    My question is, how do I delete a record from the listview? I would like to be able to select the row in the listview and delete it.

    Sorry if I am not as specific as I need to be, but I'm not sure where to start.

    Thank you for any help in this endeavour.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Montreal, Canada
    Posts
    486
    Rep Power
    11
    you just want to remove one item from the listview ?

    listview1.items(#).remove

    the # is the item in the list you want to remove starting from 0

    I believe you would like to remove the item that is selected from the user in the list then

    listview1.items(listview1.selectedindex).remove
    or something similar to that depending on your needs etc...
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Essex, ON
    Posts
    18
    Rep Power
    0

    removing an item from a Listview


    Thanks for the reply and it works. I guess I should have been a little more specific. Not only do I need it to be removed from the listview, but I also need it to be removed from the database permanently.

    Do I need to call the database and update or use indices in my table?

    thank you,
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Montreal, Canada
    Posts
    486
    Rep Power
    11
    yeah if you want to be removed from your Database you will have to call it !

    there is different way to do it ! I also asked wich one is the fastest etc... but haven't got answer yet.

    You can do a dataset and datarow and go delete it. I think it's not the best way and I got some problem if I delete more then 2, don't know why. Never got the problem with Vb6.

    Imo the best way is to use a Request to do it ! and just connect to your database and then start your request and it will be deleted permantly.

    one thing you could do is just to remove the item from your database and reload your listview ?

    http://forums.devshed.com/t86355/s.html

IMN logo majestic logo threadwatch logo seochat tools logo