Example #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            contact = new Contact();
            Telefon_2 addNew = new Telefon_2(contact, true);

            if (addNew.ShowDialog() == DialogResult.OK)
            {
                listBox1.Items.Add(contact);
            }
        }
Example #2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (listBox1.SelectedIndex == -1)
            {
                MessageBox.Show("No select contact...");
                return;
            }
            int i = listBox1.SelectedIndex;

            contact = (Contact)listBox1.Items[i];
            Telefon_2 edit = new Telefon_2(contact, false);

            edit.ShowDialog();
            listBox1.Items.RemoveAt(i);
            listBox1.Items.Insert(i, contact);
            listBox1.SelectedIndex = i;
        }