Results 1 to 2 of 2

Thread: Deleting data using ListView

  1. #1
    RodríguezBrown is offline Senior Member
    Join Date
    Dec 2009
    Posts
    322
    Rep Power
    3

    Default Deleting data using ListView

    Just I started using Visual Basic and unable to delete data using ListView. When I tried coding for that it is not functioning and not obtaining preferred output. My code retrieves and inputs data into table. Even I can update data using form on ListView. But I am not getting the correct coding for removing data from table using delete button even as having row chosen in ListView. I am using Visual Studio 2005. Can anyone help me?

  2. #2
    WilsonMartin is offline Senior Member
    Join Date
    Dec 2009
    Posts
    319
    Rep Power
    3

    Default

    1) Using following code delete entire row of data. Also message box added in coding so that it asks for verification.

    Sub BtnDeleteClick(sender As Object, e As EventArgs)

    Dim selItem As New ListViewItem
    Dim result As DialogResult

    result = MessageBox.Show("Are you sure you want to delete the selected item(s)?", _ "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question)

    If result = DialogResult.No Then
    MessageBox.Show("Delete action has been cancelled.", "Delete Cancelled", _
    MessageBoxButtons.OK, MessageBoxIcon.Information)

    Else
    For Each selItem In listViewRec.SelectedItems
    selItem.Remove()
    Next
    End If
    End Sub

Similar Threads

  1. Replies: 0
    Last Post: 11-11-2009, 07:48 AM
  2. Securely deleting data
    By Garrison Bravo in forum Everything Else
    Replies: 0
    Last Post: 07-15-2009, 12:19 PM
  3. Deleting potentially harmful personal data
    By Garrison Bravo in forum Applications
    Replies: 1
    Last Post: 07-14-2009, 06:24 AM
  4. Deleting data on the hard disk
    By unerina in forum Everything Else
    Replies: 0
    Last Post: 06-30-2008, 01:17 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48