// this code is inside form2
public string LabelText
{
get
{
return this.LB_name.Text;
}
set
{
this.LB_name.Text = value;
}
}
private void B_Ready_Click(object sender, EventArgs e)
{
var f2 = new Form2();
f2.LabelText = "bla bla";
f2.Show();
}
private void addImageButton_Click(object sender, EventArgs e)
{
OpenFileDialog of = new OpenFileDialog();
//For any other formats
of.Filter = "Image Files (*.bmp;*.jpg;*.jpeg,*.png)|*.BMP;*.JPG;*.JPEG;*.PNG";
if (of.ShowDialog() == DialogResult.OK)
{
pictureBox1.ImageLocation = of.FileName;
}
}
var probabilityList = new List<string>();
probabilityList.AddRange(Enumerable.Repeat("1", 40));
probabilityList.AddRange(Enumerable.Repeat("2", 30));
probabilityList.AddRange(Enumerable.Repeat("3", 20));
probabilityList.AddRange(Enumerable.Repeat("4", 10));
var rnd = new Random();
var randomItem = probabilityList[rnd.Next(probabilityList.Count)];