示例#1
0
        private void dGVElements_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            string cell = dGVElements.Rows[dGVElements.CurrentCell.RowIndex].Cells[0].Value.ToString();

            bool isEqual = false;
            foreach (object itm in lBAddedElements.Items)
            {
                string[] split = itm.ToString().Split(' ');
                string title = split[0];

                if (cell.Equals(title))
                {
                    isEqual = true;
                    break;
                }
            }

            if (isEqual)
            {
                MessageBox.Show("Элемент уже добавлен!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                int nMaxElement = Int32.Parse(dGVElements.Rows[dGVElements.CurrentCell.RowIndex].Cells[2].Value.ToString());
                using (ElementCountForm form = new ElementCountForm(nMaxElement))
                {
                    form.ShowDialog();
                }
            }
        }
示例#2
0
        private void dGVElements_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            string cellTitle = (sender as DataGridView)["Обозначение", (sender as DataGridView).CurrentCell.RowIndex].Value.ToString();

            bool isEqual = false;
            for (int i = 0; i < dGVFirstElements.RowCount; i++)
            {
                string title = dGVFirstElements["Обозначение", i].Value.ToString();
                if (cellTitle == title)
                {
                    isEqual = true;
                    break;
                }
            }

            if (isEqual)
            {
                MessageBox.Show("Элемент уже добавлен!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                int row = (sender as DataGridView).CurrentCell.RowIndex;
                string sMasElement = (sender as DataGridView)["Кол-во на складе", row].Value.ToString();
                int nMaxElement = Int32.Parse(sMasElement);

                using (ElementCountForm form = new ElementCountForm(nMaxElement))
                {
                    form.ShowDialog();
                }
            }
        }