private void dgvDocs_CellClick(object sender, DataGridViewCellEventArgs e) { if (dgvDocs.CurrentCell.ColumnIndex.Equals(0) && e.RowIndex != -1) { if (dgvDocs.CurrentCell != null && dgvDocs.CurrentCell.Value != null) { string jsonVal = dgvDocs.Rows[e.RowIndex].Cells[5].Value.ToString(); StockPosition posObject = JsonConvert.DeserializeObject <StockPosition>(jsonVal); frmPositions newPos = new frmPositions(); newPos.thisPos = posObject; //newPos.MdiParent = this.MdiParent; newPos.ShowDialog(); } } }
private void dgvDocs_CellClick(object sender, DataGridViewCellEventArgs e) { if (dgvDocs.CurrentCell.ColumnIndex.Equals(0) && e.RowIndex != -1) { if (dgvDocs.CurrentCell != null && dgvDocs.CurrentCell.Value != null) { string jsonVal = dgvDocs.Rows[e.RowIndex].Cells[16].Value.ToString(); StockPosition posObject = new StockPosition(dgvDocs.Rows[e.RowIndex].Cells[1].Value.ToString(), Convert.ToDecimal(dgvDocs.Rows[e.RowIndex].Cells[2].Value.ToString()), Convert.ToDecimal(dgvDocs.Rows[e.RowIndex].Cells[5].Value.ToString()), Convert.ToDecimal(dgvDocs.Rows[e.RowIndex].Cells[9].Value.ToString()), Convert.ToDecimal(dgvDocs.Rows[e.RowIndex].Cells[8].Value.ToString())); posObject.TotalCount = Convert.ToDecimal(dgvDocs.Rows[e.RowIndex].Cells[2].Value.ToString()); posObject.TotalCost = Convert.ToDecimal(dgvDocs.Rows[e.RowIndex].Cells[5].Value.ToString()); posObject.TotalRevenue = Convert.ToDecimal(dgvDocs.Rows[e.RowIndex].Cells[9].Value.ToString()); posObject.ProfitnLoss = Convert.ToDecimal(dgvDocs.Rows[e.RowIndex].Cells[10].Value.ToString()); posObject.TradeList = JsonConvert.DeserializeObject <List <StockData> >(jsonVal); frmPositions newPos = new frmPositions(); newPos.thisPos = posObject; //newPos.MdiParent = this.MdiParent; newPos.ShowDialog(); } } }