Пример #1
0
        private void Form3_Load(object sender, EventArgs e)
        {
            Personel personel = Context.Personels.Find(_iD);

            foreach (PropertyInfo property in personel.GetType().GetProperties())
            {
                var controls = this.Controls.Find(property.Name, true);

                if (controls[0] is Label)
                {
                    controls[0].Text = property.GetValue(personel).ToString();
                }
                else if (controls[0] is PictureBox)
                {
                    PictureBox pcb = (PictureBox)controls[0];
                    pcb.Image = Image.FromFile(Environment.CurrentDirectory + @"\..\..\Images" + property.GetValue(personel).ToString());
                }
            }
        }