using System;
using System.Windows.Forms;
namespace Пример_2
{
public partial class Form1 : Form
{
public Form1()
{
TextBox tb = new TextBox();
Button btn = new Button();
Label lbl = new Label();
this.Text = "День недели";
this.Size = new System.Drawing.Size(300, 150);
tb.Location = new System.Drawing.Point(20, 20);
tb.Size = new System.Drawing.Size(120, 20);
tb.Text = "18.05.2026";
btn.Location = new System.Drawing.Point(150, 18);
btn.Text = "Узнать";
btn.Click += (s, e) =>
{
DateTime d = DateTime.Parse(tb.Text);
string[] days = { "Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб" };
lbl.Text = d.ToString("dd.MM.yyyy") + " - " + days[(int)d.DayOfWeek];
};
lbl.Location = new System.Drawing.Point(20, 55);
lbl.Size = new System.Drawing.Size(250, 30);
this.Controls.Add(tb);
this.Controls.Add(btn);
this.Controls.Add(lbl);
}
}
}