DataGridView
aがソートされているかどうかを判断するにはどうすればよいですか? ブール値を取得する必要があります。
If isDgSorted
-Do something
else
-Do something
助言がありますか?
DataGridView
aがソートされているかどうかを判断するにはどうすればよいですか? ブール値を取得する必要があります。
If isDgSorted
-Do something
else
-Do something
助言がありますか?
DataGridView コントロール内の項目が昇順または降順で並べ替えられているか、並べ替えられていないかを示す値を取得します。
Dim Col1 As DataGridViewColumn = DataGridView1.SortedColumn
'If Col1 is null, then the DataGridView is not currently sorted.
したがって、結果は次のようになります。
If DataGridView1.SortedColumn Is Nothing Then
'Isn't sorted
Else
'It is sorted
End If
詳細については、Microsoft がこちらで詳しく説明しています。
以下を使用できます。
Private Sub dataGridView_ColumnHeaderMouseClick(sender As Object, e As DataGridViewCellMouseEventArgs) Handles DataGridView.ColumnHeaderMouseClick
Select Case e.ColumnIndex
Case 0
'handles first column being clicked
Case 1
'handles second column being clicked
Case 3
'handles third column being clicked and so on
End Select
End Sub