document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1.     Private Sub ButtonDelete_Click(sender As Object, e As EventArgs) Handles ButtonDelete.Click
  2.         Dim MetuRow As DataGridViewRow
  3.         Dim ID As String
  4.  
  5.         For Each MetuRow In DataGridViewContact.SelectedRows
  6.             ID = MetuRow.Cells(0).Value
  7.         Next
  8.  
  9.         Console.WriteLine("Deleting ID " + ID)
  10.         Try
  11.             Conn = New SqlCeConnection
  12.             Cmd = New SqlCeCommand
  13.             Conn.ConnectionString = MyConString
  14.             Cmd.Connection = Conn
  15.             Cmd.CommandText = "DELETE FROM TableContact WHERE(ID = " + ID + ")"
  16.  
  17.             Conn.Open()
  18.             Cmd.ExecuteNonQuery()
  19.             Conn.Close()
  20.             MessageBox.Show("ID " + ID + " deleted")
  21.             LoadData()
  22.  
  23.         Catch ex As Exception
  24.             MessageBox.Show(ex.ToString)
  25.         End Try
  26.     End Sub
');