private void EditButtonOnClick(object sender, EventArgs eventArgs)
        {
            int[] sel = tableView1.GetSelectedRows();
            if (sel.Length != 1)
            {
                MessageBox.Show("Please select exactly one row.");
                return;
            }
            DataRow2 row             = table.GetRow(sel[0]);
            IsobaricLabelsEditForm f = new IsobaricLabelsEditForm(new IsobaricLabelInfo((string)row[0], (string)row[1], (double)row[2],
                                                                                        (double)row[3], (double)row[4], (double)row[5], (bool)row[6]));

            f.ShowDialog();
            if (f.DialogResult != DialogResult.OK)
            {
                return;
            }
            IsobaricLabelInfo info = f.Info;

            row[0] = info.internalLabel;
            row[1] = info.terminalLabel;
            row[2] = info.correctionFactorM2;
            row[3] = info.correctionFactorM1;
            row[4] = info.correctionFactorP1;
            row[5] = info.correctionFactorP2;
            row[6] = info.tmtLike;
            tableView1.Invalidate(true);
        }
        public IsobaricLabelsEditForm(IsobaricLabelInfo info)
        {
            InitializeComponent();
            cancelButton.Click += CancelButtonOnClick;
            okButton.Click     += OkButtonOnClick;
            string[] internallabels = Tables.InternalIsobaricLabelModifications.Keys.ToArray();
            Array.Sort(internallabels);
            internalLabelComboBox.Items.Add("<None>");
            internalLabelComboBox.Items.AddRange(internallabels);
            int i1 = Array.BinarySearch(internallabels, info.internalLabel);

            if (i1 >= 0)
            {
                internalLabelComboBox.SelectedIndex = i1 + 1;
            }
            else
            {
                internalLabelComboBox.SelectedIndex = 0;
            }
            string[] terminalLabels = Tables.TerminalIsobaricLabelModifications.Keys.ToArray();
            Array.Sort(terminalLabels);
            terminalLabelComboBox.Items.Add("<None>");
            terminalLabelComboBox.Items.AddRange(terminalLabels);
            int i2 = Array.BinarySearch(terminalLabels, info.terminalLabel);

            if (i2 >= 0)
            {
                terminalLabelComboBox.SelectedIndex = i2 + 1;
            }
            else
            {
                terminalLabelComboBox.SelectedIndex = 0;
            }
            correctionFactorM2TextBox.Text = "" + info.correctionFactorM2;
            correctionFactorM1TextBox.Text = "" + info.correctionFactorM1;
            correctionFactorP1TextBox.Text = "" + info.correctionFactorP1;
            correctionFactorP2TextBox.Text = "" + info.correctionFactorP2;
            tmtLikeCheckBox.Checked        = info.tmtLike;
        }