private void EditDetails_BasicUser_button_Click(object sender, EventArgs e) { this.Hide(); this.regForm = new BasicUser_Registration_Form(ref basicUser, false); regForm.FormClosed += new FormClosedEventHandler(RegForm_FormClosed); regForm.ShowDialog(); }
private void AddNewTeachingAssist_button_Click(object sender, EventArgs e) { /*AddNewTeachingAssistantForm regForm = new AddNewTeachingAssistantForm(); * regForm.FormClosed += new FormClosedEventHandler(FormClosedHandling); * regForm.ShowDialog(); * regForm.CallBasicUserRegisteration(); * //regForm = null; */ this.Hide(); //BasicUser newUser = null; //BasicUser_Registration_Form regForm = new BasicUser_Registration_Form(ref newUser); this.teachingAssist = new TeachingAssistant(); this.teachingAssist.FirstName = "empty"; BasicUser temp = (BasicUser)this.teachingAssist; BasicUser_Registration_Form regForm = new BasicUser_Registration_Form(ref temp); regForm.FormClosed += new FormClosedEventHandler(FormClosedHandling); regForm.ShowDialog(); if (temp != null) { String tempt = "The new user details: FirstName:" + temp.FirstName + ", lastname:" + temp.LastName + ",password:"******"INSERT INTO TeachingAssistantTable (firstName, lastName, id, age, userName,password) VALUES(%s, %s, %s, %d, %s, %s)", temp.FirstName, temp.LastName, temp.Id, temp.Age, temp.Username, temp.Password); * //sql = "SELECT * FROM TeachingAssistantTable"; * * command = new SqlCommand(sql, conn); * adapter.SelectCommand = command; * adapter.Fill(ds); * adapter.Dispose(); * command.Dispose(); * * String result = ""; * for (i = 0; i <= ds.Tables[0].Rows.Count - 1; i++) * { * result+= (ds.Tables[0].Rows[i].ItemArray[0] + "--" + ds.Tables[0].Rows[i].ItemArray[1] + "--" + ds.Tables[0].Rows[i].ItemArray[2] + "--" + ds.Tables[0].Rows[i].ItemArray[3] + "--" + ds.Tables[0].Rows[i].ItemArray[4] + "--" + ds.Tables[0].Rows[i].ItemArray[5] + "\n"); + + } */ // -------------------------------------------------------------------- } }
private void RegForm_FormClosed(object sender, FormClosedEventArgs e) { this.regForm.Close(); this.regForm = null; this.Show(); }