2012年12月19日 星期三

vb.net datagridview 選取

參考引用:
--
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        '將所選取的反過來讀取
        For i As Integer = DataGridView1.SelectedCells.Count - 1 To 0 Step -1
            MsgBox(DataGridView1.SelectedCells(i).Value)
        Next
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        For i As Integer = DataGridView1.SelectedRows.Count - 1 To 0 Step -1
            MsgBox(DataGridView1.SelectedRows(i).Cells(0).Value)
        Next
    End Sub

沒有留言:

張貼留言