public StudentInfo(Data.Students Students) { InitializeComponent(); txtStdId.Text = (Students.Student_Id); txtStdName.Text = Gulipso.DataDecrypt(Students.Name); txtStdFname.Text = Gulipso.DataDecrypt(Students.FatherName); txtStdCNIC.Text = Gulipso.DataDecrypt(Students.CNIC); txtStdEmail.Text = Gulipso.DataDecrypt(Students.Email); txtStdContact.Text = Gulipso.DataDecrypt(Students.Contact); }
void bw_DoWork(object sender, DoWorkEventArgs e) { try { Data.Students std = new Data.Students() { Name = Student_Name, FatherName = Student_FName, Email = Student_Email, Contact = Student_Contact, Course_Id = Course_ID, Student_Id = Student_ID, CNIC = Student_CNIC }; db.Students.Add(std); db.SaveChanges(); } catch (Exception ex) { MessageBox.Show("An error occured: " + ex.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }