public void Copy(Student elem, Student kyda) { kyda.Name = elem.Name; kyda.Surname = elem.Surname; kyda.Lastname = elem.Lastname; kyda.Age = elem.Age; kyda.Pol = elem.Pol; kyda.StudentGroup = elem.StudentGroup; }
public FunkWithStudent(Student s,Languauge l) { InitializeComponent(); txtName.Text = s.Name; txtSur.Text = s.Surname; txtSurname.Text = s.Lastname; numericAge.Value = s.Age; comboPol.Items.Add(l.Man); comboPol.Items.Add(l.Woman); comboPol.SelectedItem = s.Pol; comboGroup.Text = s.StudentGroup.GroupStudent; this.Text = l.NameFormEdit; ChangeLang(l); }
public MainInform() { InitializeComponent(); lang = new Languauge(KindLanguage.Russian); all = new List<Student>(); tmp = new Student(); //lngMenu=new Student(); //labName.DataBindings.Add("Text", lngMenu, "Name"); //label2.DataBindings.Add("Text", lngMenu, "Surname"); //label3.DataBindings.Add("Text", lngMenu, "Lastname"); //label4.DataBindings.Add("Text", lngMenu, "Age"); /////////// //label5.DataBindings.Add("Text", lngMenu, "Pol"); //label6.DataBindings.Add("Text", lngMenu, "StudentGroup.GroupStudent"); btNew.Click += new EventHandler(buttonClick); btEdit.Click += new EventHandler(buttonClick); btAllRight.Click += new EventHandler(btAll_Click); btAllLeft.Click += new EventHandler(btAll_Click); txtName.DataBindings.Add("Text", tmp, "Name"); txtSurname.DataBindings.Add("Text", tmp, "Surname"); txtSur.DataBindings.Add("Text", tmp, "Lastname"); txtAge.DataBindings.Add("Text", tmp, "Age"); /////////// txtPol.DataBindings.Add("Text", tmp, "Pol"); txtGroup.DataBindings.Add("Text", tmp, "StudentGroup.GroupStudent"); btDelete.Enabled = false; btEdit.Enabled = false; btAllLeft.Enabled = false; btOneLeft.Enabled = false; btOneRight.Enabled = false; btAllRight.Enabled = false; btSave.Enabled = false; openToolStripMenuItem.Click += new EventHandler(btOpen_Click); saveToolStripMenuItem.Click += new EventHandler(btSave_Click); newToolStripMenuItem.Click += new EventHandler(buttonClick); changeToolStripMenuItem.Click += new EventHandler(buttonClick); deleteToolStripMenuItem.Click += new EventHandler(btDelete_Click); menuStrip1.BackColor = Color.Cyan; ChangeLangForm1(); saveToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S; saveToolStripMenuItem.ShowShortcutKeys = true; }
private void btOpen_Click(object sender, EventArgs e) { StreamReader read; OpenFileDialog op = new OpenFileDialog(); if (op.ShowDialog() == DialogResult.OK) { read = File.OpenText(op.FileName); Student prom = new Student(); all.Clear(); do { prom.Name = read.ReadLine(); prom.Lastname = read.ReadLine(); prom.Surname = read.ReadLine(); prom.Age = Convert.ToInt32(read.ReadLine()); prom.Pol = read.ReadLine(); prom.StudentGroup.GroupStudent = read.ReadLine(); read.ReadLine(); all.Add(prom); } while (read.EndOfStream); read.Close(); Copy(all[curentIndex],tmp); Enable(); } }