'---How to get the index of the currently selected row If InvoicesDataGridView.Rows.Count > 0 Then Dim rowIndex As Integer = _ InvoicesDataGridView.CurrentCell.RowIndex End If '---How to get the value of the first cell in the selected row Dim row As DataGridViewRow = _ InvoicesDataGridView.Rows(rowIndex) Dim cell As DataGridViewCell = row.Cells(0) Dim invoiceID As Integer = CInt(cell.Value) '---How to set the value of the first cell in the selected row Dim invoiceID As Integer = 10 Dim row As DataGridViewRow = _ InvoicesDataGridView.Rows(rowIndex) row.Cells(0).Value = invoiceID '---How to loop through all rows in the grid Dim grandTotal As Decimal = 0 For Each row As DataGridViewRow _ In InvoicesDataGridView.Rows Dim cell As DataGridViewCell = row.Cells(3) Dim invoiceTotal As Decimal = CDec(cell.Value) grandTotal += invoiceTotal Next '---How to refresh the grid InvoicesDataGridView.Refresh() '---A method that handles the CellDoubleClick event Private Sub InvoicesDataGridView_CellDoubleClick( _ ByVal sender As System.Object, _ ByVal e As _ System.Windows.Forms.DataGridViewCellEventArgs) _ Handles InvoicesDataGridView.CellDoubleClick Dim rowIndex As Integer = e.RowIndex Me.DisplayLineItems(rowIndex) End Sub '---How to delete a row InvoicesDataGridView.Rows.RemoveAt(rowIndex)