try this
string columnName = "YourColumnName";
int index = 0;
for (int i = 0; i < GridView1.Columns.Count; i++)
{
if (GridView1.Columns[i].HeaderText == columnName)
{ index = i; break; }
}
txtmytext.text = GridView1.Rows[i].Cells[index].Text;
There is no pointing of iterating the rows of the gridview to assign the value to the textbox, however it will assign the last index value to it. Please correct it