コード例 #1
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGridView1.SelectedRows.Count <= 0 || dataGridView1.SelectedRows[0].Cells[fieldName].Value == null)
            {
                return;
            }

            string matId   = dataGridView1.SelectedRows[0].Cells["商品编号"].Value.ToString().Trim();
            int    matType = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["类型"].Value.ToString().Trim().Substring(0, 1));

            dataGridView1.SelectedRows[0].Cells["库存"].Value = ReceiptModCfg.GetStockNum(this.SStorehouseId, matId, matType).stockNum;
        }
コード例 #2
0
        private void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            int index = e.RowIndex;

            if (dataGridView1.Rows[index].Cells["商品编号"].Value == null || dataGridView1.Rows[index].Cells["商品编号"].Value.ToString().Trim() == "")
            {
                return;
            }

            if (dataGridView1.Rows[index].Cells["库存"].Value == null || dataGridView1.Rows[index].Cells["库存"].Value.ToString().Trim() == "")
            {
                string matId   = dataGridView1.Rows[index].Cells["商品编号"].Value.ToString().Trim();
                int    matType = Convert.ToInt32(dataGridView1.Rows[index].Cells["类型"].Value.ToString().Trim().Substring(0, 1));

                dataGridView1.Rows[index].Cells["库存"].Value = ReceiptModCfg.GetStockNum(this.SStorehouseId, matId, matType).stockNum;
            }
        }