求助!datagridview如何判断行标题被选中?
求教如何判断当前选择是通过行标题栏进行的行选择的?
下面这段代码好像不行。。。
Dim intRow As Integer
intRow = DataGridView1.CurrentCell.RowIndex
If DataGridView1.Rows(intRow).HeaderCell.Selected = True Then
。。。。
End if
'将8楼的回复修正一下,因为如果只选择一行的话,结果不准确
Dim MaxRow As Integer = -1, MinRow As Integer = -1
For i As Integer = DataGridView1.Rows.Count - 1 To 0 Step -1
If DataGridView1.Rows(i).Selected = True Then
If MaxRow = -1 Then
MaxRow = i : MinRow = i
Else
MinRow = i
End If
End If
Next
MsgBox("您选择的最大行号是:" & MaxRow.ToString & "最小行号是:" & MinRow.ToString)