in your row command event handler of the grid view, code something like this
Private Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView1.RowCommand
Dim myprimarykey As Integer
myprimarykey=gridView1.Rows(e.CommandArgument).Cells.Item(0).Text
MessageBox.Show("You pressed the button for the record" & myprimarykey)
end sub
you can also utilize e.CommandName (put the commandname in button description when designing gridview and adding a button column,) perform if-else to check which button was pressed (if the grid offers more than one type of button)
for more help, refer
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridviewcommandeventargs.aspx[
^]