Dim i As Integer
For i = 0 To dasSale.Tables("Sale").Rows.Count-1
If dtgSale.IsSelected(i) Then
intSelectedRowNum += 1
End If
Next
If intSelectedRowNum > 5 Then
DtgRrSale.UnSelect(DtgRrSale.CurrentRowIndex)
MsgBox("You cannot select more than 5 rows!")
End If
Catch ex As Exception
.....
End Try