Yes No MessageBox

DialogResult dlg = MessageBox.Show(“Sure?”, “Title”, MessageBoxButtons.YesNo);

if(dlg == DialogResult.Yes)

{ //do something }

else if(dlg == DialogResult.No)

{ //do something else }

Add combo box item from ListBox

List<string> CCode = new List<string>();

CylinderCOdeComboBox.DataSource = null;

CCode.Add(“item1”);

CylinderCodeComboBox.DataSource = CCode;

Load image

pictureBox1.Image = Image.FromFile(@”C:\Users\…jpg”);

OR

OpenFileDialog open = new OpenFileDialog();

open.Filter = “Image Files(*.jpg;*.jpeg;*.gif;*.bmp)|*.jpg;*.jpeg;*.gif;*.bmp”;

if(open.ShowDialog() == DialogResult.OK)

{

pictureBox1.Image = new Bitmap(open.FileName);

}

 

*In Window form, pictureBox does not take image from Image.FromStream, only from bitmap.