Results 1 to 4 of 4

Thread: [RESOLVED] list view

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2006
    Posts
    146

    Resolved [RESOLVED] list view

    plz some one tell me the code for deleting a selected item from listview as well as from acsess database
    i know the code for vb but for vb.net there is something wrong
    Using VB.NET 2003/.NET 1.1

    If you found a post useful then please Rate it!
    Please mark you thread resolved using the Thread Tools above

  2. #2
    Fanatic Member Jumpercables's Avatar
    Join Date
    Jul 2005
    Location
    Colorado
    Posts
    592

    Re: list view

    Handling database connections and data drastically different then in VB6 so you are going to need to read up on ADO.NET tutorial to make a connection, update and read information from a database.

    I believe there is a selected index property for a listview, so it might look something like ...

    VB Code:
    1. ListView1.Item.RemoveAt(ListView1.Item.SelectedIndex)

    C# - .NET 1.1 / .NET 2.0

    "Take everything I say with a grain of salt, sometimes I'm right, sometimes I'm wrong but in the end we've both learned something."
    _____________________
    Regular Expressions Library
    Connection String
    API Functions
    Database FAQ & Tutorial

  3. #3
    Lively Member Shardox's Avatar
    Join Date
    Nov 2006
    Location
    Barcelona, Spain
    Posts
    123

    Re: list view

    Also, if you have multiple selection allowed in your listview you can iterate through selected items collection:

    VB Code:
    1. For each item as ListViewItem in ListView.SelectedItems
    2.      ListView.Items.Remove(item)
    3. Next

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Aug 2006
    Posts
    146

    Re: list view

    VB Code:
    1. For Each lsvrow As ListViewItem In lvwdb.SelectedItems
    2.             lvwdb.Items.Remove(lsvrow)
    Using VB.NET 2003/.NET 1.1

    If you found a post useful then please Rate it!
    Please mark you thread resolved using the Thread Tools above

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