htBox.Text = picture.Height.ToString(); widthBox.Text = picture.Width.ToString(); picture.Height += 10; picture.Width += 10; if (picture.Height > 340) { MessageBox.Show("Can not increase further"); picture.Height = 202; picture.Width = 277; htBox.Text = picture.Height.ToString(); widthBox.Text = picture.Width.ToString(); }