private void button1_Click(object sender, EventArgs e) { ChangeAvatar form = new ChangeAvatar(); DialogResult result = form.ShowDialog(); if (result == DialogResult.OK) { pictureBox1.Image = form.selectedImage; image = form.selectedImage; } }
private void button1_Click(object sender, EventArgs e) { User user = (User)listBox1.SelectedItem; if (user != null) { ChangeAvatar avatarForm = new ChangeAvatar(); DialogResult result = avatarForm.ShowDialog(); if (result == DialogResult.OK) { user.avatar = avatarForm.selectedImage; pictureBox1.Image = user.avatar; } } }