Its Very Simple Your method will not work because you make object of form1 each object has its own memory...So it will defiantly not going to be work so for that..
Make one static variable name Id (If u have id in table 'login')
or you can use whatever field you may like to use instead of id
public static Int32 UserID;
private void btnsearch_Click(object sender, EventArgs e)
Form2 f2 = new Form2();
if (UserID != 0)
in Form2 at click event..
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
Form1.UserID = 12;
Or Use can make more static variables each for user-password,user-role and so on...but i will not suggest that method...Use Above method it is easiest way...Gud Luck