2012年12月19日 星期三

vb.net datagridview 選取

參考引用:
--
  1. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  2. '將所選取的反過來讀取
  3. For i As Integer = DataGridView1.SelectedCells.Count - 1 To 0 Step -1
  4. MsgBox(DataGridView1.SelectedCells(i).Value)
  5. Next
  6. End Sub
  7.  
  8. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  9. For i As Integer = DataGridView1.SelectedRows.Count - 1 To 0 Step -1
  10. MsgBox(DataGridView1.SelectedRows(i).Cells(0).Value)
  11. Next
  12. End Sub

沒有留言:

張貼留言