private void toolStripLabel1_Click(object sender, EventArgs e) { if (DGV1.Rows.Count > 0) portFolioCounter = DGV1.Rows.Cast<DataGridViewRow>().Max(r => Convert.ToInt32(r.Cells["PF"].Value)); else portFolioCounter = 0; portFolioCounter++; using (AddToken _AddToken = new AddToken()) { _AddToken.txtpfName.Text = portFolioCounter.ToString(); _AddToken.lblPfName.Visible = true; _AddToken.txtpfName.Visible = true; _AddToken.Text = "Add Near Month Token"; _AddToken.button1.Text = "Add Next Token"; if (_AddToken.ShowDialog() == DialogResult.OK) { DataRow dr = SpreadTable.NewRow(); dr["PF"] = _AddToken._objOut.PFName; dr["NEAR"] = _AddToken._objOut.Desc1; dr["Token1"] = _AddToken._objOut.Token1; dr["FAR"] = _AddToken._objOut.Desc2; dr["Token2"] = _AddToken._objOut.Token2; dr["TOK1_QTY"] = _AddToken._objOut.tok1_qty1; dr["TOK2_QTY"] = _AddToken._objOut.tok2_qty2; SpreadTable.Rows.Add(dr); DGV1.Rows[DGV1.Rows.Count-1].Cells["BNSFDIFF"].Value = 0.00; DGV1.Rows[DGV1.Rows.Count-1].Cells["BFSNDIFF"].Value = 0.00; DGV1.Rows[DGV1.Rows.Count-1].Cells["BNSFMNQ"].Value = 0.00; DGV1.Rows[DGV1.Rows.Count-1].Cells["BFSNMNQ"].Value = 0.00; DGV1.Rows[DGV1.Rows.Count-1].Cells["BNSFMXQ"].Value = 0.00; DGV1.Rows[DGV1.Rows.Count-1].Cells["BFSNMXQ"].Value = 0.00; DGV1.Rows[DGV1.Rows.Count - 1].Cells["TICKS"].Value = 0; UDP_Reciever.Instance.Subscribe = _AddToken._objOut.Token1; UDP_Reciever.Instance.Subscribe = _AddToken._objOut.Token2; } } }
private void toolStripLabel1_Click(object sender, EventArgs e) { if (portFolioCounter==0) portFolioCounter = 1; using (AddToken _AddToken = new AddToken()) { _AddToken.txtpfName.Text = portFolioCounter.ToString(); _AddToken.lblPfName.Visible = true; _AddToken.txtpfName.Visible = true; _AddToken.Text = "Add Near Month Token"; _AddToken.button1.Text = "Add Next Token"; if (_AddToken.ShowDialog() == DialogResult.OK) { DataRow dr = SpreadTable.NewRow(); dr["PF"] = _AddToken._objOut.PFName; dr["NEAR"] = _AddToken._objOut.Desc1; dr["Token1"] = _AddToken._objOut.Token1; dr["FAR"] = _AddToken._objOut.Desc2; dr["Token2"] = _AddToken._objOut.Token2; SpreadTable.Rows.Add(dr); //dr["BFSNDIFF"] = 0.0000; //dr["BNSFDIFF"]=0.0000; //dr["BNSFMNQ"] = 0.0000; //dr["BFSNMNQ"] = 0.0000; //dr["BNSFMXQ"] = 0.0000; //dr["BFSNMXQ"] = 0.0000; DGV1.Rows[DGV1.Rows.Count-1].Cells["BNSFDIFF"].Value = 0.00; DGV1.Rows[DGV1.Rows.Count-1].Cells["BFSNDIFF"].Value = 0.00; DGV1.Rows[DGV1.Rows.Count-1].Cells["BNSFMNQ"].Value = 0.00; DGV1.Rows[DGV1.Rows.Count-1].Cells["BFSNMNQ"].Value = 0.00; DGV1.Rows[DGV1.Rows.Count-1].Cells["BNSFMXQ"].Value = 0.00; DGV1.Rows[DGV1.Rows.Count-1].Cells["BFSNMXQ"].Value = 0.00; DGV1.Rows[DGV1.Rows.Count - 1].Cells["TICKS"].Value = 0; UDP_Reciever.Instance.Subscribe = _AddToken._objOut.Token1; UDP_Reciever.Instance.Subscribe = _AddToken._objOut.Token2; //FOPAIRDIFF portFolioCounter++; } } }