Example #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            var form = new ApartmentDescriptionForm2(new ApartmentDescription());
            var res  = form.ShowDialog(this);

            if (res == DialogResult.OK)
            {
                listBox1.Items.Add(form.ad);
            }
        }
Example #2
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            var ad = listBox1.SelectedItem as ApartmentDescription;

            if (ad == null)
            {
                return;
            }
            var form = new ApartmentDescriptionForm2(ad.Clone());
            var res  = form.ShowDialog(this);

            if (res == DialogResult.OK)
            {
                var si = listBox1.SelectedIndex;
                listBox1.Items.Remove(si);
                listBox1.Items.Insert(si, form.ad);
            }
        }