Exemplo n.º 1
0
 private void Form1_Load(object sender, EventArgs e)
 {
     //ButtonSave.Enabled = false;
     //ButtonDell.Enabled = false;
     //ButtonCancel.Enabled = false;
     ButtonSave.Hide();
     ButtonDell.Hide();
     ButtonCancel.Hide();
     ReadText("ankets.txt");
 }
Exemplo n.º 2
0
        private void ButtonCancel_Click(object sender, EventArgs e)
        {
            ListBox1.ClearSelected();
            CLearFields();
            ButtonAdd.Show();
            ButtonCLear.Show();

            ButtonSave.Hide();
            ButtonDell.Hide();
            ButtonCancel.Hide();
        }
Exemplo n.º 3
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;
                }
            }
        }
Exemplo n.º 4
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");
        }