private void btnAddIndexSpec_Click(object sender, EventArgs e)
 {
     IndexSpecsForm dlg = new IndexSpecsForm();
     dlg.StartPosition = FormStartPosition.CenterParent;
     DialogResult dr = dlg.ShowDialog(this);
     if (dr == DialogResult.OK)
     {
         lbIndexes.Items.Add(dlg.Index);
     }
 }
        private void btnEditIndexSpec_Click(object sender, EventArgs e)
        {
            Index index = lbIndexes.SelectedItem as Index;

            IndexSpecsForm dlg = new IndexSpecsForm();
            dlg.StartPosition = FormStartPosition.CenterParent;

            dlg.SetIndex(index);

            DialogResult dr = dlg.ShowDialog(this);
            if (dr == DialogResult.OK)
            {
                lbIndexes.Items[lbIndexes.SelectedIndex] = dlg.Index;
            }
        }