DataGridView 按钮事件...
按钮列
DataGridView 提供的一种列是 DataGridViewButtonColumn,这种列在每一项旁边显示一个按钮。您可以响应此按钮的单击事件,并使用它启动其他操作或显示新的表单。
图 3 显示了包含新列的网格。以下代码会对任何行中的按钮单击事件做出反应,并显示相应的记录信息:
Private Sub DataGridView1_CellClick( _
ByVal sender As System.Object, _
ByVal e As System.Windows.Forms. _
DataGridViewCellEventArgs) _
Handles DataGridView1.CellClick
If DataGridView1.Columns(e.ColumnIndex).Name = _
"Details" Then
MessageBox.Show("You picked " & _
DataGridView1.Rows(e.RowIndex). _
Cells("CustomerID").Value)
End If
End Sub
能帮我翻译(C#)一下上面的代码吗? 我对VB实在是不懂...