2016-04-25 143 views
0

我在datagridview中有一个单元格,它位于第8行第2列单元格和那个单元格只有点击时我想显示为另存为dialogbox,但我实际上可以获得一个点击事件发生的具体细胞如何在vb.net中做到这一点?datagridview中特定单元格的点击事件vb.net

回答

0

在你的dataGridView “事件DataGridView1_CellClick” 添加以下代码:

Private Sub DataGridView1_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick 

    If e.ColumnIndex = 2 And e.RowIndex = 8 Then 
     'Do any thing 

     MsgBox("yes" + DataGridView1.Item(e.ColumnIndex, e.RowIndex).Value.ToString()) 

    End If 
End Sub 
0
Private Sub DataGridView1_CellClick(sender As Object, e As `DataGridViewCellEventArgs`) Handles DataGridView1.CellClick 

''Code HERE............ 

End Sub 
0
Private Sub DataGridView1_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView_pos.CellContentClick 
     Dim i As Integer 

     With DataGridView_pos 
      If e.RowIndex >= 0 Then 
       i = .CurrentRow.Index 

       txt_update_detail_id.Text = .Rows(i).Cells("id").Value.ToString 

      End If 
     End With 

    End Sub 
'txt_update_detail_id.Text Output value by id (Mysql database) 
'Is work 
相关问题