I have 2 WinForms where one is parent and passing parameter to it’s chilf form. The code goes something like this:
public class FormMain : Form {
private User user;
public FormMain (User user) {
InitializeComponent();
this.user = user;
}
private void btnUpdateAccount_Click(object sender, EventArgs e)
{
updateUser = new FormUsersUpdate(user);
updateUser.Show();
}
}
and this:
public class FormUsersUpdate(User user){
//Update user in database
}
User class have some usual properties like Name, surname, etc. So my question is how to inform parent class about this update without need to again retrieve user from database?
Thanks.
You can invoke a callback delegate after the update. In
FormMain:In
FormUsersUpdate:ShowDialog is mostly a better choice but I never tried it on an mdi child: