Пример #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            var ff = new FlightForm()
            {
                Flight = new Flight()
            };

            if (ff.ShowDialog(this) == DialogResult.OK)
            {
                listBox1.Items.Add(ff.Flight);
            }
        }
Пример #2
0
        private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            int index = this.listBox1.IndexFromPoint(e.Location);

            if (index != System.Windows.Forms.ListBox.NoMatches)
            {
                var item = (Flight)listBox1.Items[index];
                var ff   = new FlightForm()
                {
                    Flight = item
                };
                if (ff.ShowDialog(this) == DialogResult.OK)
                {
                    listBox1.Items.Remove(item);
                    listBox1.Items.Insert(index, item);
                }
            }
        }