using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Zadanie6 { public partial class Form1 : Form { public Form1() { InitializeComponent(); Person person = new Person { Name = "admin", Age = 18 }; Label label1 = new Label(); label1.Location = new Point(12, 10); label1.AutoSize = true; Controls.Add(label1); Label label2 = new Label(); label2.Location = new Point(12, 40); label2.AutoSize = true; Controls.Add(label2); Button button = new Button(); button.Location = new Point(12, 80); button.Text = "Change"; button.AutoSize = true; Controls.Add(button); // изменяем свойство Name button.Click += (o, e) => person.Name = "admin"; label1.DataBindings.Add(new Binding("Text", person, "Name", false, DataSourceUpdateMode.OnPropertyChanged)); label2.DataBindings.Add(new Binding("Text", person, "Age", false, DataSourceUpdateMode.OnPropertyChanged)); } private void Form1_Load(object sender, EventArgs e) { } public class Person { public string Name { get; set; } = ""; public int Age { get; set; } } } }