コード例 #1
0
        private void paymentGridView_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView senderGrid = (DataGridView)sender;

            if (e.ColumnIndex < 0)
            {
                return;
            }

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                e.RowIndex >= 0)
            {
                DataRowView paymentRowView = (DataRowView)senderGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningRow.DataBoundItem;

                DataRow paymentRow = paymentRowView.Row;
                DataRow customer   = DocumentClass.GetCustomer(-1);

                if (customer == null)
                {
                    return;
                }

                paymentRow[PaymentImport.IDCUSTOMER_COLUMN]   = customer["idcustomer"];
                paymentRow[PaymentImport.CUSTOMERNAME_COLUMN] = customer["name"];
            }
        }