Пример #1
0
        private void btnFillRanges_Click(object sender, EventArgs e)
        {
            FillRangesDialog fillRangesDialog = new FillRangesDialog();
            DialogResult     result           = fillRangesDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                int startValue = fillRangesDialog.StartValue;
                int endValue   = fillRangesDialog.EndValue;
                int rangeValue = fillRangesDialog.RangeValue;

                DataTable rangeTable = ((DataTable)dataGridViewRecode.DataSource);
                rangeTable.Rows.Clear();

                rangeTable.Rows.Add("LOVALUE", startValue.ToString(), "LOVALUE - <" + startValue.ToString());

                for (int i = startValue; i < endValue; i = i + rangeValue)
                {
                    string lowerBound = i.ToString();
                    string upperBound = (i + rangeValue).ToString();

                    if ((i + rangeValue) > endValue)
                    {
                        upperBound = endValue.ToString();
                    }

                    rangeTable.Rows.Add(lowerBound, upperBound, lowerBound + " - <" + upperBound);
                }

                rangeTable.Rows.Add(endValue.ToString(), "HIVALUE", endValue.ToString() + " - < HIVALUE");
            }
        }
Пример #2
0
        private void btnFillRanges_Click(object sender, EventArgs e)
        {
            FillRangesDialog fillRangesDialog = new FillRangesDialog();
            DialogResult result = fillRangesDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                int startValue = fillRangesDialog.StartValue;
                int endValue = fillRangesDialog.EndValue;
                int rangeValue = fillRangesDialog.RangeValue;

                DataTable rangeTable = ((DataTable)dataGridViewRecode.DataSource);
                rangeTable.Rows.Clear();

                rangeTable.Rows.Add("LOVALUE", startValue.ToString(), "LOVALUE - <" + startValue.ToString());

                for (int i = startValue; i < endValue; i = i + rangeValue)
                {
                    string lowerBound = i.ToString();
                    string upperBound = (i + rangeValue).ToString();

                    if ((i + rangeValue) > endValue)
                    {
                        upperBound = endValue.ToString();
                    }

                    rangeTable.Rows.Add(lowerBound, upperBound, lowerBound + " - <" + upperBound);
                }

                rangeTable.Rows.Add(endValue.ToString(), "HIVALUE", endValue.ToString() + " - < HIVALUE");
            }
        }