Exemple #1
0
        private void ButtonCancel_Click(object sender, EventArgs e)
        {
            ListBox1.ClearSelected();
            CLearFields();
            ButtonAdd.Show();
            ButtonCLear.Show();

            ButtonSave.Hide();
            ButtonDell.Hide();
            ButtonCancel.Hide();
        }
Exemple #2
0
        private void ButtonDell_Click(object sender, EventArgs e)
        {
            int tem = Convert.ToInt32(LabelNumber.Text);

            for (int i = 0; i < lstPerson.Count; i++)
            {
                if (lstPerson[i].number == tem)
                {
                    lstPerson.RemoveAt(i);
                    ListBox1.Items.RemoveAt(ListBox1.SelectedIndex);
                    CLearFields();
                    ButtonAdd.Show();
                    ButtonCLear.Show();
                    ButtonSave.Hide();
                    ButtonDell.Hide();
                    ButtonCancel.Hide();
                    break;
                }
            }
        }
Exemple #3
0
        private void ButtonSave_Click(object sender, EventArgs e)
        {
            int tem = Convert.ToInt32(LabelNumber.Text);

            for (int i = 0; i < lstPerson.Count; i++)
            {
                if (lstPerson[i].number == tem)
                {
                    if (TextBoxName.Text == "" || TextBoxSurname.Text == "" || TextBoxEmail.Text == "" || MaskedTBPhone.Text == "")
                    {
                        MessageBox.Show("Заполнены не все данные!");
                    }
                    else
                    {
                        lstPerson[i].surname = TextBoxSurname.Text;
                        lstPerson[i].name    = TextBoxName.Text;
                        lstPerson[i].phone   = MaskedTBPhone.Text;
                        lstPerson[i].email   = TextBoxEmail.Text;
                        if (nameFoto != "")
                        {
                            lstPerson[i].picture = nameFoto;
                        }
                        ListBox1.Items[ListBox1.SelectedIndex] = lstPerson[i].surname + " " + lstPerson[i].name;
                        CLearFields();
                        ButtonAdd.Show();
                        ButtonCLear.Show();
                        ButtonSave.Hide();
                        ButtonDell.Hide();
                        ButtonCancel.Hide();
                        break;
                    }
                }
            }
            nameFoto          = "";
            PictureBox1.Image = Image.FromFile(@"..\..\foto\fotocap.jpg");
        }