private void button1_Click(object sender, EventArgs e) { user = textBox1.Text; password = textBox2.Text; string userdb, passworddb; returnclass rc = new returnclass(); userdb = rc.scalerReturn("select count(std_id) from student_record where std_id='" + user + "'"); if (userdb.Equals("0")) { MessageBox.Show("Invalid User Name"); } else { passworddb = rc.scalerReturn("select std_password from student_record where std_id='" + user + "'"); if (passworddb.Equals(password)) { string val = rc.scalerReturn("select count (std_id) from student_record where std_id=(select stu_id_fk from set_exam where stu_id_fk='" + textBox1.Text + "' and exam_id_fk='" + comboBox1.SelectedValue.ToString() + "')"); if (val.Equals("0")) { MessageBox.Show("NO Such Exam Set!"); } else { exam_id = comboBox1.SelectedValue.ToString(); this.t1.Show(); //aur yahan pe uss composition waly variable ko access krlia hai aur form ko show krwa dia } } else { MessageBox.Show("Invalid Password"); } } }