Results 1 to 2 of 2

Thread: [RESOLVED] MsgBoxResult.Yes

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2011
    Posts
    44

    Resolved [RESOLVED] MsgBoxResult.Yes

    Hello everyone,
    I am making an application that has employees in a listview.
    When the client clicks on one of the employees end clicks the remove button I wan to ask the client if they want to remove the employee.
    The problem is when I click NO it still removes the Item from the listview.

    My code:

    lvEmployees is my listview name.

    VB.net
    Code:
     For I = 0 To lvEmployees.SelectedItems.Count - 1
                    If Not I = -1 Then
                        MsgBox("Do you really want to remove " & lvEmployees.Items.Item(I).Text & " " & lvEmployees.Items.Item(I).SubItems(1).Text & "?", MsgBoxStyle.YesNo)
    
                        If MsgBoxResult.Yes Then
                            lvEmployees.SelectedItems.Item(I).Remove()
                        Else
                            Exit Sub
                        End If
    
                    End If
                Next
    Thanks for the help.
    Last edited by pietercdevries; Aug 16th, 2012 at 12:10 PM.

Tags for this Thread

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