private void toolStripButton_addPortfolio_Click(object sender, EventArgs e) { if (dataGridView1.DataSource != null && Model_ViewPortfolio.list != null) { string code = dataGridView1.Rows[dataGridView1.SelectedCells[0].RowIndex].Cells[0].FormattedValue.ToString(); Model_ViewPortfolio model_vp = new Model_ViewPortfolio(); model_vp.StockCode = code; Model_ViewPortfolio.list.Add(model_vp); Model_ViewPortfolio.UpdateList(); Model_ViewPortfolio.ResetWeighting(); } else { MessageBox.Show("Please load the portfolio first.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void toolStripButton_addStock_Click(object sender, EventArgs e) { try { Model_ViewPortfolio temp = new Model_ViewPortfolio(); temp.StockCode = toolStripTextBox_stockCode.Text; Model_ViewPortfolio.list.Add(temp); Model_ViewPortfolio.UpdateList(); } catch (Exception ex) { LogHelper.GetLogger(typeof(MainForm)).FullLog(ex.ToString(), "IGNORE"); } toolStripTextBox_stockCode.Text = "<Enter stock code here>"; }