PIbd-32_Turner_I.A._COP_10/COP/WinForms/Form1.cs
ityurner02@mail.ru 17102989ae вроде все
2023-09-15 22:21:56 +04:00

75 lines
2.0 KiB
C#

using System.Security.Cryptography;
using VisualComponentsLib.Object;
namespace WinForms
{
public partial class Form1 : Form
{
List<string> list = new List<string>();
List<Student> students = new List<Student>();
public Form1()
{
list = new List<string>();
list.AddRange(new string[] { "õëåá", "ìîëîêî", "êîëáàñà" });
Student student1 = new Student("Âàñèëüåâ", "ÏÈáä-32", "ÔÈÑÒ", 3);
Student student2 = new Student("Èâàíîâ", "ÐÒáä-11", "ÐÒÔ", 1);
Student student3 = new Student("Ñìèðíîâà", "ËÌÊÊáä-41", "ÃÔ", 4);
students.Add(student1);
students.Add(student2);
students.Add(student3);
InitializeComponent();
dropDownList.LoadValues(new List<string>() { "ñîê", "ÿáëîêî", "ëóê" });
emailTextBox.Pattern = @"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$";
listBoxObj.SetLayoutInfo("Ôàìèëèÿ *Name* Ãðóïïà *Group* Ôàêóëüòåò *Faculty* Êóðñ *Course*", "*", "*");
}
private void buttonAdd_Click(object sender, EventArgs e)
{
dropDownList.LoadValues(list);
}
private void buttonInfo_Click(object sender, EventArgs e)
{
labelInfo.Text = dropDownList.SelectedValue;
}
private void buttonClear_Click(object sender, EventArgs e)
{
dropDownList.Clear();
}
private void buttonSetExample_Click(object sender, EventArgs e)
{
if (textBoxExample.Text == String.Empty)
{
return;
}
emailTextBox.setExample(textBoxExample.Text);
}
private void buttonShow_Click(object sender, EventArgs e)
{
try
{
if (emailTextBox.TextBoxValue != null)
{
labelShow.Text = "ïîäõîäèò";
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void buttonAddObjects_Click(object sender, EventArgs e)
{
listBoxObj.AddInListBox<Student>(students);
}
private void buttonShowItem_Click(object sender, EventArgs e)
{
string str = listBoxObj.GetObjectFromStr<Student>().Name + " " + listBoxObj.GetObjectFromStr<Student>().Group + " " + listBoxObj.GetObjectFromStr<Student>().Faculty + " " + listBoxObj.GetObjectFromStr<Student>().Course;
labelShowInput.Text = str;
}
}
}