First, I want to inform that this forum is to discuss SQL Server questions, regarding the question about how to check the selected index of DataGridView control, we can post the question to Windows Forms forum. Additionally, you can refer to the following
codes:

Microsoft is conducting an online survey to understand your opinion of the Technet Web site. If you choose to participate, the online survey will be presented to you when you leave the Technet Web site.