private void ChangeElem_Click(object sender, EventArgs e) { errorProvider.Clear(); CreateEl element = new CreateEl(); if (element.CheckTheName(FirstName.Text)) { errorProvider.SetError(FirstName, "Введите корректное имя"); } else if (element.CheckTheName(Surname.Text)) { errorProvider.SetError(Surname, "Введите корректную фамилию"); } else if (element.CheckTheName(Thirdname.Text)) { errorProvider.SetError(Thirdname, "Введите корректное отчество"); } else { Driver driver = (Driver)ListView.SelectedItems[0].Tag; driver.wayNumber = WayNumber.SelectedIndex; driver.busNumber = BusNumber.SelectedIndex; driver.busPosition = PositionBus.SelectedIndex; driver.DName = FirstName.Text; driver.DSurname = Surname.Text; driver.DThirdname = Thirdname.Text; string fio = driver.DName[0] + ". " + driver.DThirdname[0] + ". " + driver.DSurname; ListView.SelectedItems[0].Text = fio; } }
private void AddElem_Click(object sender, EventArgs e) { CreateEl AddObject = new CreateEl(); AddObject.Owner = this; this.Enabled = false; AddObject.ShowDialog(); }