Ok, It seems like your problem is with the selectedcells portion of your statement. I have had the same issue numerous times. What I have done to resolve this as follow:
Firstly create an integer variable to store the row that you are working with.
then find the CellMouseClick event and read the row from the e.rowindex
lets assume your variable is called ri then :
do this
txtPrjNmae.Text = dataGridView2.Rows[ri].Cells[0].Value.ToString();
Hope it helps.