I have a windows form application where i have picturebox1 in Form. I have a user control and a button1 in that userControl. On click of that button i want to change the picturebox1 image in Form. Please check my code:
public partial class LoggedInForm : Form
{
public LoggedInForm()
{
InitializeComponent();
}
public PictureBox setImg
{
get { return pictureBox1; }
set { pictureBox1 = value; }
}
}
public partial class AddUserGroup : UserControl
{
private void Button1_Click(object sender, EventArgs e)
{
LoggedInForm x = new LoggedInForm();
x.setImg.Image = NewProj.Properties.Resources.Logo;
}
}