コード例 #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            var form = new DescriptionOfBreakForm(new Breakage());
            var res  = form.ShowDialog(this);

            if (res == DialogResult.OK)
            {
                mainListBox.Items.Add(form.br);
            }
        }
コード例 #2
0
        private void mainListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            var br = mainListBox.SelectedItem as Breakage;

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

            if (res == DialogResult.OK)
            {
                var si = mainListBox.SelectedIndex;
                mainListBox.Items.RemoveAt(si);
                mainListBox.Items.Insert(si, form.br);
            }
        }