how do i get exact row index in datagridview on selecting the row n pressing enter : when i select the first row im getting the row index as 1 which must be 0 if im not wrong n 2 on selecting both 2nd n 3rd row.

    private void dataGridView1_SelectionChanged(object sender, EventArgs e)
            {
                if (this.dataGridView1.SelectedRows.Count > 0)
                {
                    r = this.dataGridView1.SelectedRows[0].Index;
                }
            }
    
    
    private void dataGridView1_KeyPress(object sender, KeyPressEventArgs e)
            {
                if (e.KeyChar == 13)
                {
                    p = p+1;
                    if (p == 1)
                    {
                        if (this.dataGridView1.SelectedRows.Count > 0)
                        {
                            brand = dataGridView1.Rows[r].Cells[0].Value.ToString();
                            datadisp();
                        }
                    }
                }
            }